Dictionarydict = new Dictionary (); dict.Add("one", 1); dict.Add("two", 2); dict.Add("three", 3);
var productList = new DictionaryIn this example, we create a new dictionary object with keys and values of int and string type respectively. We then add three items to the dictionary, each with a key and a value. Package library: System.Collections.Generic.(); productList.Add(1, "Product 1"); productList.Add(2, "Product 2"); productList.Add(3, "Product 3");