How do I  

How to remove an item of a Dictionary in C#

Remove Item of a dictionary

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 Remove method removes an item with the specified key from the collection. The following code snippet removes an item.

// Remove item with key = 'Mahesh Chand'  
AuthorList.Remove("Mahesh Chand");   

The Clear method removes all items from the collection. The following code snippet removes all items by calling the Clear method.

// Remove all items  
AuthorList.Clear(); 

Next>> Dictionary In C# - A Complete Tutorial With Code Examples (c-sharpcorner.com)

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.