7

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)
guillermooo
  • 7,915
  • 15
  • 55
  • 58

2 Answers2

13
Dim a() As Integer = New Integer() {1, 2, 3}
chakrit
  • 61,017
  • 25
  • 133
  • 162
Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447
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.

David Robbins
  • 9,996
  • 7
  • 51
  • 82