Export (0) Print
Expand All

IEnumeratorContract<T> Interface

Enumerates the elements in an IListContract<T> collection.

Namespace:  System.AddIn.Contract
Assembly:  System.AddIn.Contract (in System.AddIn.Contract.dll)

public interface IEnumeratorContract<T> : IDisposable

Type Parameters

T

The type of objects being enumerated.

The IEnumeratorContract<T> type exposes the following members.

  NameDescription
Public methodDisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.)
Public methodGetCurrentReturns the object in the collection at the current position of the enumerator.
Public methodMoveNextAdvances the enumerator to the next element of the collection.
Public methodResetSets the enumerator to its initial position, which is before the first element in the collection.
Top

Enumerators can be used to read the data in the collection, but they cannot be used to modify the collection.

Initially, the enumerator is positioned before the first element in the collection. At this position, the return value of GetCurrent is undefined. Therefore, you must call MoveNext to advance the enumerator to the first element of the collection before calling GetCurrent.

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

If MoveNext passes the end of the collection, the enumerator is positioned after the last element in the collection and MoveNext returns false. When the enumerator is at this position, subsequent calls to MoveNext also return false. If the last call to MoveNext returned false, the return value of GetCurrent is undefined.

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 its behavior is undefined.

.NET Framework

Supported in: 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2015 Microsoft