c# simple list code example
Example 1: c sharp list of strings
// Create a list of strings using 'new List<string>{}'
List<string> stringList = new List<string>{"string1", "string2"};
Example 2: c# declare an int list
List<int> intList = new List<int>();
Example 3: c# writeline list
Console.WriteLine("List of Numbers: {0}",string.Join("",list));
//Output: List of Numbers: 123456789
Console.WriteLine("List of Numbers: {0}",string.Join(",",list));
//Output: List of Numbers: 1,2,3,4,5,6,7,8,9
Example 4: c# new list object
var intList = new List<int>();