Show / Hide Table of Contents

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
IResettable.Reset()
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 Source

Current

Declaration
T Current { get; }
Property Value
Type Description
T

Methods

View Source

MoveNext()

Declaration
bool MoveNext()
Returns
Type Description
bool
View Source

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 T.

View Source

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 T.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, params ReadOnlySpan<T>)
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾