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.

Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public interface IEnumerator<in TSelf, out T> where TSelf : struct, IEnumerator<in TSelf, out T>
Type Parameters
Name Description
TSelf

The value type that implements an enumerator.

T
Remarks

The enumerator doesn't implement IEnumerator<T> interface implicitly but can be converted to it by using regular type cast.

Properties

| Edit this page View Source

Current

Gets the element in the collection at the current position of the enumerator.

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

The element in the collection at the current position of the enumerator.

Methods

| Edit this page View Source

MoveNext()

Advances the enumerator to the next element of the collection.

Declaration
bool MoveNext()
Returns
Type Description
bool

true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

Exceptions
Type Condition
InvalidOperationException

The collection was modified after the enumerator was created.

| Edit this page View Source

Reset()

Sets the enumerator to its initial position, which is before the first element in the collection.

Declaration
void Reset()
Exceptions
Type Condition
InvalidOperationException

The collection was modified after the enumerator was created.

NotSupportedException

The enumerator does not support being reset.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾