Table of Contents

Class SafeEnumerator<T>

Namespace
Loehnert.Lisrt.Messaging
Assembly
Loehnert.Lisrt.dll

A thread-safe IEnumerator implementation.

public class SafeEnumerator<T> : IEnumerator<T>, IDisposable, IEnumerator

Type Parameters

T

The element type of the enumerator.

Inheritance
SafeEnumerator<T>
Implements
Inherited Members

Constructors

SafeEnumerator(IEnumerator<T>, object)

Initializes a new instance of the SafeEnumerator<T> class.

public SafeEnumerator(IEnumerator<T> inner, object @lock)

Parameters

inner IEnumerator<T>

Inner enumerator.

lock object

Lock object.

Properties

Current

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

public T Current { get; }

Property Value

T

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

MoveNext()

Advances the enumerator to the next element of the collection.

public bool MoveNext()

Returns

bool

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

Remarks

We just delegate actual implementation to the inner enumerator, that actually iterates over some collection.

Reset()

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

public void Reset()