Show / Hide Table of Contents

Class Enumerator

Various methods to work with classes implementing IEnumerable<T> interface.

Inheritance
object
Enumerator
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public static class Enumerator

Methods

View Source

Create<T, TEnumerator>(in TEnumerator)

Creates the classic enumerator.

Declaration
public static IEnumerator<T> Create<T, TEnumerator>(in TEnumerator enumerator) where T : allows ref struct where TEnumerator : struct, IEnumerator<TEnumerator, T>
Parameters
Type Name Description
TEnumerator enumerator

The enumerator to convert.

Returns
Type Description
IEnumerator<T>

The classic enumerator.

Type Parameters
Name Description
T
TEnumerator

The type of the enumerator.

View Source

Create<T, TEnumerator>(in TEnumerator, CancellationToken)

Creates the async enumerator.

Declaration
public static IAsyncEnumerator<T> Create<T, TEnumerator>(in TEnumerator enumerator, CancellationToken token) where T : allows ref struct where TEnumerator : struct, IEnumerator<TEnumerator, T>
Parameters
Type Name Description
TEnumerator enumerator

The enumerator to convert.

CancellationToken token

The token that can be used to cancel the enumeration.

Returns
Type Description
IAsyncEnumerator<T>

The async enumerator.

Type Parameters
Name Description
T
TEnumerator

The type of the enumerator.

View Source

Limit<T>(IEnumerator<T>, int, bool)

Limits the number of the elements in the sequence.

Declaration
public static Enumerator.LimitedEnumerator<T> Limit<T>(this IEnumerator<T> enumerator, int count, bool leaveOpen = false) where T : allows ref struct
Parameters
Type Name Description
IEnumerator<T> enumerator

The sequence of the elements.

int count

The maximum number of the elements in the returned sequence.

bool leaveOpen

false to dispose enumerator; otherwise, true.

Returns
Type Description
Enumerator.LimitedEnumerator<T>

The enumerator which is limited by count.

Type Parameters
Name Description
T

The type of items in the sequence.

View Source

Skip<TEnumerator, T>(ref TEnumerator, int)

Bypasses a specified number of elements in a sequence.

Declaration
public static bool Skip<TEnumerator, T>(this ref TEnumerator enumerator, int count) where TEnumerator : struct, IEnumerator<T>, allows ref struct where T : allows ref struct
Parameters
Type Name Description
TEnumerator enumerator

Enumerator to modify.

int count

The number of elements to skip.

Returns
Type Description
bool

true, if current element is available; otherwise, false.

Type Parameters
Name Description
TEnumerator

The type of the sequence.

T

The type of the elements in the sequence.

View Source

op_LeftShift<T>(IAsyncEnumerator<T>, int)

Bypasses a specified number of elements in a sequence.

Declaration
public static ValueTask<bool> op_LeftShift<T>(IAsyncEnumerator<T> enumerator, int count) where T : allows ref struct
Parameters
Type Name Description
IAsyncEnumerator<T> enumerator

Enumerator to modify. Cannot be null.

int count

The number of elements to skip.

Returns
Type Description
ValueTask<bool>

true, if current element is available; otherwise, false.

Type Parameters
Name Description
T
Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

View Source

op_LeftShift<T>(IEnumerator<T>, int)

Bypasses a specified number of elements in a sequence.

Declaration
public static bool op_LeftShift<T>(IEnumerator<T> enumerator, int count) where T : allows ref struct
Parameters
Type Name Description
IEnumerator<T> enumerator

Enumerator to modify. Cannot be null.

int count

The number of elements to skip.

Returns
Type Description
bool

true, if current element is available; otherwise, false.

Type Parameters
Name Description
T
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾