IEnumeratorContract<T>.GetCurrent Method

Definition

Returns the object in the collection at the current position of the enumerator.

public T GetCurrent ();

Returns

T

The IContract in the collection at the current position of the enumerator.

Remarks

The return value of GetCurrent 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 or after Reset is called. MoveNext must be called to advance the enumerator to the first element of the collection before calling GetCurrent.

  • The last call to 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.

GetCurrent returns the same object until MoveNext is called. MoveNext sets the return value of GetCurrent to the next element.

Applies to

מוצר גירסאות
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1