System.Collections.IDictionaryEnumerator.Value Property

Gets the value of the current dictionary entry.

Syntax

public object Value { get; }

Value

A object that contains the DictionaryEntry.Value of 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.Value property; otherwise, IDictionaryEnumerator.Value is undefined.

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

IDictionaryEnumerator.Value does not move the position of the enumerator, and consecutive calls to IDictionaryEnumerator.Value 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