在VB.NET中等效的Array()?

时间:2021-06-15 21:14:52

In VB6 you can do this:

在VB6中,您可以这样做:

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

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

你能在VB.NET中用特定的类型做类似的事情吗?

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

2 个解决方案

#1


13  

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

#2


0  

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.

如果您是.NET新手,您将需要了解List集合以及它在排序,过滤和迭代方面的灵活性。

#1


13  

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

#2


0  

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.

如果您是.NET新手,您将需要了解List集合以及它在排序,过滤和迭代方面的灵活性。