Interface IEnumerator<TSelf, T>
Represents ad-hoc enumerator implemented as value type to avoid enumerator allocation and prevent the compiler to generate Dispose() call.
Inherited Members
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public interface IEnumerator<TSelf, out T> : IResettable where TSelf : struct, IEnumerator<TSelf, out T> where T : allows ref struct
Type Parameters
| Name | Description |
|---|---|
| TSelf | The value type that implements an enumerator. |
| T | The type of objects to enumerate. |
Remarks
The enumerator doesn't implement IEnumerator<T> interface implicitly but can be converted to it by using regular type cast.
Properties
View SourceCurrent
Declaration
T Current { get; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
View SourceMoveNext()
Declaration
bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool |
ToAsyncEnumerator(in TSelf, CancellationToken)
Converts ad-hoc enumerator to a generic enumerator.
Declaration
protected static IAsyncEnumerator<out T> ToAsyncEnumerator(in TSelf enumerator, CancellationToken token)
Parameters
| Type | Name | Description |
|---|---|---|
| TSelf | enumerator | Ad-hoc enumerator. |
| CancellationToken | token | The token that can be used to cancel the enumeration. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerator<T> | The enumerator over values of type |
ToEnumerator(in TSelf)
Converts ad-hoc enumerator to a generic enumerator.
Declaration
protected static IEnumerator<out T> ToEnumerator(in TSelf enumerator)
Parameters
| Type | Name | Description |
|---|---|---|
| TSelf | enumerator | Ad-hoc enumerator. |
Returns
| Type | Description |
|---|---|
| IEnumerator<T> | The enumerator over values of type |