How to find a key in a SortedDictionary with C#

Find a Key

The ContainsKey method checks if a key is already exists in the SortedDictionary. The following code snippet checks if a key is already exits and if not, add one. 

if (!AuthorList.ContainsKey("Mahesh Chand"))

{

    AuthorList["Mahesh Chand"] = 20;

}

 

Learn more:

Working with SortedDictionary using C#

Up Next
    Ebook Download
    View all
    Learn
    View all