Interface IEnumerator<TSelf, T>
Represents ad-hoc enumerator implemented as value type to avoid enumerator allocation and prevent the compiler to generate Dispose() call.
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public interface IEnumerator<in TSelf, out T> where TSelf : struct, IEnumerator<in TSelf, out T>
Type Parameters
Name | Description |
---|---|
TSelf | The value type that implements an enumerator. |
T |
Remarks
The enumerator doesn't implement IEnumerator<T> interface implicitly but can be converted to it by using regular type cast.
Properties
| Edit this page View SourceCurrent
Gets the element in the collection at the current position of the enumerator.
Declaration
T Current { get; }
Property Value
Type | Description |
---|---|
T | The element in the collection at the current position of the enumerator. |
Methods
| Edit this page View SourceMoveNext()
Advances the enumerator to the next element of the collection.
Declaration
bool MoveNext()
Returns
Type | Description |
---|---|
bool | true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The collection was modified after the enumerator was created. |
Reset()
Sets the enumerator to its initial position, which is before the first element in the collection.
Declaration
void Reset()
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The collection was modified after the enumerator was created. |
NotSupportedException | The enumerator does not support being reset. |