In c# I can initialize a List at creation time like
var list = new List<String>() {"string1", "string2"};
is there a similar thing in VB.Net? Currently I can do it like
Dim list As New List(Of String)
list.Add("string1")
list.Add("string2")
list.Add("string3")
but I want to avoid boring .Add lines
VB10 supports collection initializers. I believe your example would be:
MSDN has more information.
Though if it's VB 2010 I'd definitely go with Jon Skeet's answer.
You can also use AddRange if you don't want to put all of your items on a single line.