Class BaseParallelEnumerator<T1, T2>
- Namespace
- Garyon.Objects.Enumerators
- Assembly
- Garyon.dll
Provides the base mechanism for a parallel enumerator for 2 IEnumerator<T> objects.
public abstract class BaseParallelEnumerator<T1, T2> : BaseParallelEnumerator
Type Parameters
T1The type of the elements the first IEnumerator<T> enumerates.
T2The type of the elements the second IEnumerator<T> enumerates.
- Inheritance
-
BaseParallelEnumerator<T1, T2>
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseParallelEnumerator(IEnumerable<T1>, IEnumerable<T2>)
Initializes a new instance of the BaseParallelEnumerator<T1, T2> class.
protected BaseParallelEnumerator(IEnumerable<T1> enumerator1, IEnumerable<T2> enumerator2)
Parameters
enumerator1IEnumerable<T1>The first enumerator.
enumerator2IEnumerable<T2>The second enumerator.
Properties
Enumerator1
Gets the first enumerator.
protected IEnumerator<T1> Enumerator1 { get; }
Property Value
- IEnumerator<T1>
Enumerator1Alive
Determines whether the first enumerator has not reached the end of the collection.
public bool Enumerator1Alive { get; }
Property Value
Enumerator2
Gets the second enumerator.
protected IEnumerator<T2> Enumerator2 { get; }
Property Value
- IEnumerator<T2>
Enumerator2Alive
Determines whether the second enumerator has not reached the end of the collection.
public bool Enumerator2Alive { get; }
Property Value
Methods
Dispose()
Calls the Dispose() method on both enumerators.
public virtual void Dispose()
GetCurrentValue<T>(int)
Gets the current value of the IEnumerator<T> at the specified index.
protected override T? GetCurrentValue<T>(int index)
Parameters
indexintThe zero-based index of the IEnumerator<T>.
Returns
- T
The current value of the IEnumerator<T>, if the given IEnumerator<T> is alive, otherwise default.
Type Parameters
TThe type of the current value.
MoveNext()
Advances both enumerators to the next element of each collection.
public virtual bool MoveNext()
Returns
- bool
true if any of the two enumerators was successfully advanced to the next element; false if both enumerators have passed the end of the collection.
Reset()
Sets both enumerators to their initial position, which is before the first element in each collection.
public virtual void Reset()