System 2.0.0.0 4.0.0.0 System.ValueType System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey,TValue>> System.Collections.IDictionaryEnumerator

The generic class is a binary search tree with O(log ) retrieval, where is the number of elements in the dictionary. In this respect, it is similar to the generic class. The two classes have similar object models, and both have O(log ) retrieval. Where the two classes differ is in memory use and speed of insertion and removal:

uses less memory than .

has faster insertion and removal operations for unsorted data: O(log ) as opposed to O() for .

If the list is populated all at once from sorted data, is faster than .

Each key/value pair can be retrieved as a structure, or as a through the nongeneric interface.

Keys must be immutable as long as they are used as keys in the . Every key in a must be unique. A key cannot be null, but a value can be, if the value type is a reference type.

requires a comparer implementation to perform key comparisons. You can specify an implementation of the generic interface by using a constructor that accepts a parameter; if you do not specify an implementation, the default generic comparer is used. If type implements the generic interface, the default comparer uses that implementation.

The foreach statement of the C# language (for each in C++, For Each in Visual Basic) requires the type of each element in the collection. Since each element of the is a key/value pair, the element type is not the type of the key or the type of the value. Instead, the element type is . The following code shows C#, C++, and Visual Basic syntax.

code reference: Generic.Dictionary#11

The foreach statement is a wrapper around the enumerator, which allows only reading from the collection, not writing to it.

Represents a collection of key/value pairs that are sorted on the key.

- Property
  2.0.0.0
  4.0.0.0
  System.Collections.Generic.KeyValuePair<TKey,TValue> To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean To be added. To be added. To be added.
- Property
  2.0.0.0
  4.0.0.0
  System.Collections.DictionaryEntry To be added. To be added. To be added.
- Property
  2.0.0.0
  4.0.0.0
  System.Object To be added. To be added. To be added.
- Property
  2.0.0.0
  4.0.0.0
  System.Object To be added. To be added. To be added.
- Property
  2.0.0.0
  4.0.0.0
  System.Object To be added. To be added. To be added.
- Method
  2.0.0.0
  4.0.0.0
  System.Void To be added. To be added.