Equivalent of Array() in VB.NET?

2019-04-07 04:30发布

问题:

In VB6 you can do this:

Dim a As Variant
a = Array(1, 2, 3)

Can you do a similar thing in VB.NET with specific types, like so?:

Dim a() As Integer
a = Array(1, 2, 3)

回答1:

Dim a() As Integer = New Integer() {1, 2, 3}


回答2:

If you are new to .NET you will want to learn about the List collection and the flexibility it will give you in respect to sorting, filtering, and iteration.



标签: vb.net vb6