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