System.Collections.Specialized.StringEnumerator.Current Property

Gets the current element in the collection.

Syntax

public string Current { get; }

Value

Documentation for this section has not yet been entered.

Remarks

After an enumerator is created or after a StringEnumerator.Reset is called, StringEnumerator.MoveNext must be called to advance the enumerator to the first element of the collection before reading the value of StringEnumerator.Current; otherwise, StringEnumerator.Current is undefined.

StringEnumerator.Current also throws an exception if the last call to StringEnumerator.MoveNext returned false, which indicates the end of the collection.

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

An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to IEnumerator.MoveNext or IEnumerator.Reset throws an InvalidOperationException. If the collection is modified between IEnumerator.MoveNext and IEnumerator.Current, IEnumerator.Current returns the element that it is set to, even if the enumerator is already invalidated.

Requirements

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