DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="5.11.0" />

 Enumerator

public static class Enumerator
Various methods to work with classes implementing IEnumerable<T> interface.

Wrapped for the enumerator which is limited by count.

public static IAsyncEnumerator<T> GetAsyncEnumerator<T>(this IEnumerable<T> enumerable, CancellationToken token = default)

Obtains asynchronous enumerator over the sequence of elements.

public static LimitedEnumerator<T> Limit<T>(this IEnumerator<T> enumerator, int count, bool leaveOpen = false)

Limits the number of the elements in the sequence.

public static bool Skip<T>(this IEnumerator<T> enumerator, int count)

Bypasses a specified number of elements in a sequence.

public static bool Skip<TEnumerator, T>(this ref TEnumerator enumerator, int count) where TEnumerator : struct, IEnumerator<T>

Bypasses a specified number of elements in a sequence.

public static IEnumerator<T> ToEnumerator<T>(ReadOnlyMemory<T> memory)

Gets enumerator over all elements in the memory.

public static IEnumerator<T> ToEnumerator<T>(ref ReadOnlySequence sequence)

Gets enumerator over all elements in the sequence.