Visual Basic 2008 中的集合初始化语法? [英] Collection initialization syntax in Visual Basic 2008?

查看:17
本文介绍了Visual Basic 2008 中的集合初始化语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试确定在 Visual Basic 2008(Express 版,如果重要的话)中是否有办法进行内联集合初始化,如 JavaScript 或 Python:

I'm trying to determine if there's a way in Visual Basic 2008 (Express edition if that matters) to do inline collection initialization, a la JavaScript or Python:

Dim oMapping As Dictionary(Of Integer, String) = {{1,"First"}, {2, "Second"}}

我知道 Visual Basic 2008 支持这样的数组初始化,但我似乎无法让它用于集合......我的语法有误,还是没有实现?

I know Visual Basic 2008 supports array initialization like this, but I can't seem to get it to work for collections... Do I have the syntax wrong, or is it just not implemented?

推荐答案

Visual Basic 9.0 尚不支持此功能.但是,Visual Basic 10.0 .

Visual Basic 9.0 doesn't support this yet. However, Visual Basic 10.0 will.

这篇关于Visual Basic 2008 中的集合初始化语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆