How to count a dictionary items with C#

The Count property gets the number of key/value pairs in a Dictionary.
  1. Dictionary<string, Int16> AuthorList = new Dictionary<string, Int16>();  
  3. AuthorList.Add("Mahesh Chand", 35);  
  4. AuthorList.Add("Mike Gold", 25);  
  5. AuthorList.Add("Praveen Kumar", 29);  
  6. AuthorList.Add("Raj Beniwal", 21);  
  7. AuthorList.Add("Dinesh Beniwal", 84);  
The following code snippet displays the number of items in a dictionary:
  1. Console.WriteLine("Count: {0}", AuthorList.Count);  

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.