开发者

VB.NET 9 / VS 2008 - Array Literal?

Is there an array literal in VB.NET 9/ VS2008? Something like this pseudo-code:

Dim MyArray = {"e1", "e2", "e3"}

Or maybe some list that can be created instantly (pseudo-code):

Dim MyList = List("e1", "e2开发者_如何学C", "e3")


Dim MyArray = New Integer() { 1, 2, 3 }
' Or
Dim MyArray() As Integer = { 1, 2, 3 }
' Or
Dim MyArray() = { 1, 2, 3 }
' Or
Dim MyArray() = { 1, 2, "A", "B" }

All work equally well. If you choose the third one, it will infer the type and give you the correct type of array (integer in this case). The fourth one will give you an object array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜