I am writing my test code and I do not want to write wo:
List<string> nameslist = new List<string>(); nameslist.Add("one"); nameslist.Add("two"); nameslist.Add("three");
I would like to write
List<string> nameslist = new List<string>({"one", "two", "three"});
However, {"one", "two", "three"} is not an "IEnumerable string Collection". How can I initialize this in a single line using the IEnumerable Collection line ??
collections list initialization c #
Johannes Dec 14 '10 at 10:31
source share