Dictionary - Description


The generic class Dictionary has two type parameters, K - the key type, and T - the data type. The generic class Dictionary exists in the namespace Calculus (in assembly Calculus.dll).

When creating a dictionary Dictionary<K,T>, the key class K is expected to be comparable. There are two ways in which the comparer for class K can be specified:

  1. the class K may derive from IComparable of K or
  2. the constructor Dictionary - Comparer may be used to manually specify the comparer.

The declaration of the dictionary class (in C#) is shown below.

[Serializable]
public class Dictionary<K,T> : IDictionary<K,T>,
                               IEquatable<Dictionary<K,T>>              
{
 ...
}

When foreach is applied to a dictionary, the entries are presented in key order.