开发者

VB.NET 9 / VS 2008 - Array Literal?

开发者 https://www.devze.com 2023-03-25 18:01 出处:网络
Is there an array literal in VB.NET 9/ VS2008? Something like this pseudo-code: Dim MyArray = {\"e1\", \"e2\", \"e3\"}

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

精彩评论

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

关注公众号