c# add key to dictionary code example
Example 1: c# dictionary add
Dictionary<char, string> alphabetCode = new Dictionary<char, string>();
alphabetCode.Add('A', "Alpha");
Example 2: c# add key value pair to dictionary
d.Add(new KeyValuePair<int, string>(1, "TVs"));
Example 3: c sharp add item to dictionary
// To add an item to a dictionary use 'Add()'
dict.Add(1,"One");