VOOZH about

URL: https://www.geeksforgeeks.org/c-sharp/c-sharp-dictionary-count-property/

⇱ C# | Dictionary.Count Property - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

C# | Dictionary.Count Property

Last Updated : 11 Jul, 2025
This property is used to get the number of key/value pairs contained in the Dictionary. Syntax:
public int Count { get; }
Return Value : The number of key/value pairs contained in the Dictionary. Below are the programs to illustrate the use of above-discussed property: Example 1:
Output:
Total key/value pairs in myDict are : 6
Example 2:
Output:
Total key/value pairs in myDict are : 6
Note: Retrieving the value of this property is an O(1) operation. Reference:
Comment

Explore