Add Items
The Add method adds an item to the Dictionary collection in form of a key and a value.
The following code snippet creates a Dictionary and adds an item by using the Add method.
Dictionary<string, Int16> AuthorList = new Dictionary<string, Int16>(); AuthorList.Add("Mahesh Chand", 35);
The following code snippet adds an item and updates the existing item in the collection.
AuthorList["Neel Beniwal"] = 9; AuthorList["Mahesh Chand"] = 20;