How to get and set an Item of a dictionary in C#

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 the value of an item. 

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"]);


Similar Articles
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.