tags:

views:

374

answers:

3

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)
+12  A: 
Dim a() As Integer = New Integer() {1, 2, 3}
Jonathan Allen
A: 

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
I normally use them, but I'm converting a VB6 app and taking the easy route for the moment.
guillermooo
A: 

And how to do the following?

array("a" => "First", "b" => "Secord")

?

Any way?


Like this?

Dim a() As Boolean = New Boolean() {"a" >= "First", "b" >= "Secord"}


ee, you really should start a new question for this! But, very quickly, as a total guess it looks to me like you're creating an associative array in PHP?!? It's certainly not VB6. If I'm right have a look at the Collection object in VB.NET