c# list string initialize code example
Example 1: c# list string initialize inline
List<string> games = new List<string>() { "Doom", "Tetris", "City of Heroes" }
Example 2: c# how to set string list
// This will create a new list called 'nameOfList':
var nameOfList = new List<string>
{
"value1",
"value2",
"value3"
};
Example 3: instantiate list with values c#
var list = new List<string> {
"test1",
"test2",
"test3"
};