static void Main() { //Empty constructor with the default capacity. If some value is written like parameter in the constructor //the capacity will be equal to this parameter. GenericList <int> col = new GenericList <int>(); //add some elements to the collection col.Add(2); col.Add(77); col.Add(33); col.Add(7447); Console.WriteLine("the elements of the collection: " + col.ToString()); Console.WriteLine("The capacity = " + col.Capacity); Console.WriteLine("The element at index[1] is: " + col[1]); //set new value at index [1] col[1] = 666; Console.WriteLine("The new value in index [1] is: " + col[1]); Console.WriteLine("Count of the collection = " + col.Count); //Removing element at index [0] col.RemoveAt(0); Console.WriteLine(); Console.WriteLine("Collection after removing: " + col.ToString()); Console.WriteLine("Count of the collection after removing: " + col.Count); //inserting element in the collection Console.WriteLine("collection before inserting: " + col.ToString()); col.InsertAt(2, 9999999); Console.WriteLine("collection after inserting: " + col.ToString()); //Clear and print capacity and Count col.Clear(); Console.WriteLine(); Console.WriteLine("After the clear -----------------------"); Console.WriteLine("Capacity = " + col.Capacity); Console.WriteLine("Count = " + col.Count); Console.WriteLine("Collection: " + col.ToString()); Console.WriteLine(); //finding index by its value if exist. If do not exist return -1 col.Add(2); col.Add(3); col.Add(-1); col.Add(-99); //print the collection after adding some values Console.WriteLine("Collection: " + col.ToString()); int max = col.Max(); Console.WriteLine("max = " + max); int min = col.Min(); Console.WriteLine("min = " + min); int value = 3; int index = col.indexOf(value); if (index > 0) { Console.WriteLine("The element with value: {0} is on index: {1}", value, index); } else { Console.WriteLine("The element with value: {0} is not found.", value); } }