C# OrderedDictionary Count
Description
OrderedDictionary Count
gets the number of key/values
pairs contained in the OrderedDictionary collection.
Syntax
OrderedDictionary.Count
has the following syntax.
public int Count { get; }
Example
using System;// www . j a v a 2 s.co m
using System.Collections;
using System.Collections.Specialized;
public class SamplesStringCollection {
public static void Main() {
OrderedDictionary myOrderedDictionary = new OrderedDictionary();
myOrderedDictionary.Add("testKey1", "testValue1");
myOrderedDictionary.Add("testKey2", "testValue2");
myOrderedDictionary.Add("keyToDelete", "valueToDelete");
myOrderedDictionary.Add("testKey3", "testValue3");
Console.WriteLine( myOrderedDictionary.Count);
}
}
The code above generates the following result.