Table of Contents

Class IndexedAsyncEnumerator<T>

Namespace
Garyon.Objects.Enumerators
Assembly
Garyon.dll

An enumerator that enumerates elements of an IEnumerable<T> while also preserving the enumeration index.

public class IndexedAsyncEnumerator<T> : IAsyncEnumerator<IndexedEnumeratorResult<T>>, IAsyncDisposable

Type Parameters

T

The type of elements that are being enumerated.

Inheritance
IndexedAsyncEnumerator<T>
Implements
Inherited Members
Extension Methods

Constructors

IndexedAsyncEnumerator(IAsyncEnumerable<T>)

Initializes a new instance of the IndexedAsyncEnumerator<T> class from an IAsyncEnumerable<T>, using its GetAsyncEnumerator(CancellationToken) function.

public IndexedAsyncEnumerator(IAsyncEnumerable<T> originalEnumerable)

Parameters

originalEnumerable IAsyncEnumerable<T>

The original IAsyncEnumerable<T> whose IAsyncEnumerator<T> to wrap with this IndexedAsyncEnumerator<T>.

IndexedAsyncEnumerator(IAsyncEnumerator<T>)

Initializes a new instance of the IndexedAsyncEnumerator<T> class from an IAsyncEnumerator<T>.

public IndexedAsyncEnumerator(IAsyncEnumerator<T> originalEnumerator)

Parameters

originalEnumerator IAsyncEnumerator<T>

The original IAsyncEnumerator<T> to wrap with this IndexedAsyncEnumerator<T>.

Properties

Current

Gets the current IndexedEnumeratorResult<T> in the enumerator.

public IndexedEnumeratorResult<T> Current { get; }

Property Value

IndexedEnumeratorResult<T>

Index

The current index in the enumerator.

public int Index { get; }

Property Value

int

Methods

DisposeAsync()

Disposes the async enumerator by calling its DisposeAsync() implementation.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

MoveNextAsync()

Advances the enumerator asynchronously to the next element of the collection.

public ValueTask<bool> MoveNextAsync()

Returns

ValueTask<bool>

A ValueTask<TResult> that will complete with a result of true if the enumerator was successfully advanced to the next element, or false if the enumerator has passed the end of the collection.