How to get
and set an Item of a dictionary with C#
The Item
property gets and sets the value associated with the specified key.
The
following code snippet sets and gets an items value.
Dictionary<string,
Int16> AuthorList = new Dictionary<string, Int16>();
// Set Item
value
AuthorList["Mahesh Chand"] = 20;
// Get Item
value
Int16 age =
Convert.ToInt16(AuthorList["Mahesh Chand"]);