string[] fruits = { "apple", "banana", "orange" }; int index = Array.IndexOf(fruits, "banana");
Listnames = new List () { "John", "Mary", "Tom" }; names.Remove("Mary");
DictionaryIn this example, we use the indexer of the Dictionary class to set the value of the item "John" to 26. Package Library: System.Collections.Genericages = new Dictionary (); ages.Add("John", 25); ages.Add("Mary", 30); ages["John"] = 26;