In VB.NET 2010, you can do things like:
Dim list As New List(Of String) From { "one", "two", "three" }
In 2008 and below, you are stuck in initializing your lists after you create them.
Dim list As New List(Of String) list.Add("one") list.Add("two") list.Add("three")
Or you can shorten it a bit and do it (this will not work if you declare your List(Of T) as IList(Of T) ):
Dim list As New List(Of String) list.AddRange(New String() { "one", "two", "three" })
source share