System.Collections.Generic.IEnumerator<T>.Current Property

Gets the element in the collection at the current position of the enumerator.


public T Current { get; }


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


An unspecified exception type

If IEnumerator.MoveNext is not called before the first call to IEnumerator<T>.Current.


If the previous call to IEnumerator.MoveNext returned false , indicating the end of the collection.


IEnumerator`1.Current is undefined under any of the following conditions:

  • The enumerator is positioned before the first element in the collection, immediately after the enumerator is created. IEnumerator.MoveNext must be called to advance the enumerator to the first element of the collection before reading the value of IEnumerator`1.Current.

  • The last call to IEnumerator.MoveNext returned false, which indicates the end of the collection.

  • The enumerator is invalidated due to changes made in the collection, such as adding, modifying, or deleting elements.

IEnumerator`1.Current returns the same object until IEnumerator.MoveNext is called. IEnumerator.MoveNext sets IEnumerator`1.Current to the next element.


Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0