Well, the things you can do with primitive (and String) arrays:
Dim array As New String() Dim array As New String() { "one", "two", "three" } If (New String() { "one", "two", "three" }).Contains("one") Then ' Do something for "one" End If
If you upgrade to VB.NET 2010, you will get additional array initialization capabilities, but if you use 2008 or below the shortest, you can create your own lists, maybe something like this:
Dim list As New List(Of String) list.AddRange(New String() { "one", "two", "three" })
And touch the point of declaring things without assigning them to a variable: .NET is strongly typed, therefore, although you do not always need to declare a variable, your objects should always be of the same type (and must be specified via New ).
source share