System.Collections.DictionaryEntry Structure

Defines a dictionary key/value pair that can be set or retrieved.

See Also: DictionaryEntry Members


public struct DictionaryEntry


The IDictionaryEnumerator.Entry method returns an instance of this type.

The foreach statement of the C# language (for each in Visual C++, For Each in Visual Basic) requires the type of each element in the collection. Since each element of the IDictionary 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 DictionaryEntry. For example:

code reference: System.Collections.DictionaryEntry#01

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

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.


Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0,,