See Also: Dictionary<TKey,TValue> Members
- TKey
- Documentation for this section has not yet been entered.
- TValue
- Documentation for this section has not yet been entered.
Each element is a key/value pair that can be retrieved as a KeyValuePair<TKey, TValue> object.
Dictionary<TKey, TValue> requires an equality comparer implementation to perform comparisons. If no equality comparer is provided, the following default equality comparer approach is used: If type TKey implements IEquatable<TKey>, that implementation is used; otherwise, TKey's implementations of System.Object.Equals(Object) and System.Object.GetHashCode() are used. In any case, you can specify a IEqualityComparer<TKey> implementation in a constructor overload that accepts an equality comparer parameter.
After its insertion in a dictionary, changes to the value of a key that affect the equality comparer render the dictionary's behavior unspecified. Every key in a dictionary must be unique according to the equality comparer. A key cannot be null, but a value can be, if the value type TValue is a reference type.
The capacity of a dictionary is the number of elements that dictionary can hold. As elements are added to a dictionary, the capacity is automatically increased.
This type contains a member that is a nested type, called Enumerator. Although Enumerator is a member of this type, Enumerator is not described here; instead, it is described in its own entry, Dictionary<TKey,TValue>.Enumerator.