Listnames = new List (); names.Insert(0, "John"); // inserts "John" at index 0
ListThis example creates a new List of integers, and then inserts the integer value 100 at index 2 using the Insert method. The System.Collections.Generic namespace is part of the .NET Standard Library.numbers = new List { 1, 2, 3, 4, 5 }; numbers.Insert(2, 100); // inserts 100 at index 2