System.Collections.IDictionaryEnumerator.Entry Property

Gets both the key and the value of the current dictionary entry.

Syntax

public DictionaryEntry Entry { get; }

Value

The DictionaryEntry in the collection over which the current instance is positioned.

Exceptions

TypeReason
InvalidOperationException

The IDictionaryEnumerator is positioned before the first element of the dictionary or after the last element.

-or-

The dictionary was modified after the IDictionaryEnumerator was created.

Remarks

After an enumerator is created or after the IEnumerator.Reset method is called, the IEnumerator.MoveNext method must be called to advance the enumerator to the first element of the collection before reading the value of the IDictionaryEnumerator.Entry property; otherwise, IDictionaryEnumerator.Entry is undefined.

IDictionaryEnumerator.Entry also throws an exception if the last call to IEnumerator.MoveNext returned false, which indicates the end of the collection.

IDictionaryEnumerator.Entry does not move the position of the enumerator, and consecutive calls to IDictionaryEnumerator.Entry return the same object until either IEnumerator.MoveNext or IEnumerator.Reset is called.

Requirements

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