Possible Duplicate:
Collection initialization syntax in Visual Basic 2008?
How is the following C# code translated to VB.NET?
var theVar = new List<string>{"one", "two", "three"};
Collection initializers are only available in VB.NET 2010, released 2010-04-12:
Dim theVar = New List(Of String) From { "one", "two", "three" }
Use this syntax for VB.NET 2005/2008 compatibility:
Dim theVar As New List(Of String)(New String() {"one", "two", "three"})
Although the VB.NET 2010 syntax is prettier.
精彩评论