Listnumbers = new List (); numbers.Add(1); numbers.Add(2); numbers.Add(3);
DictionaryIn this example, we create a dictionary to store phone contacts and use the Add method to add three pairs of strings to it. Package library: System.Collections.Genericcontacts = new Dictionary (); contacts.Add("John", "555-1234"); contacts.Add("Jane", "555-5678"); contacts.Add("Bob", "555-9876");