Listnumbers = new List () {1, 2, 3, 4, 5}; foreach(int num in numbers) { Console.WriteLine(num); }
DictionaryThis code creates a DictionaryphoneBook = new Dictionary (); phoneBook.Add("John Smith", 5551234); phoneBook.Add("Jane Doe", 5555678); phoneBook.Add("Bob Johnson", 5559012); Console.WriteLine("Bob's number is " + phoneBook["Bob Johnson"]);