Method SwitchWhen
- Namespace
- Gamelogic.Extensions.Algorithms
- Assembly
- Gamelogic.Extensions.dll
SwitchWhen<TSource>(IGenerator<TSource>, Func<TSource, bool>, IGenerator<TSource>)
Generates elements from the source generator until a condition is met, then generate elements from a second generator.
public static IGenerator<TSource> SwitchWhen<TSource>(this IGenerator<TSource> source, Func<TSource, bool> predicate, IGenerator<TSource> newGenerator)
Parameters
sourceIGenerator<TSource>The source.
predicateFunc<TSource, bool>The predicate.
newGeneratorIGenerator<TSource>The new generator.
Returns
- IGenerator<TSource>
A new generator
Type Parameters
TSourceThe type of the source generator.
Exceptions
- ArgumentNullException
sourceis null- ArgumentNullException
predicateis null- ArgumentNullException
newGeneratoris null