theklc theklc - 7 days ago 4x
C# Question

How to initialize a C# string list (List<string>) with many string values

How is it possible to initialize (with a C# initializer) a list of strings? I have tried with the example below but it's not working.

List<string> optionList = new List<string>

List<string> mylist = new List<string>{ "element1", "element2", "element3" };

I shall refrain from being worried about some of the details in the OP's list... :)