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> initialSource, Func<TSource, bool> predicate, IGenerator<TSource> newSource)
Parameters
initialSource
IGenerator<TSource>The source.
predicate
Func<TSource, bool>The predicate.
newSource
IGenerator<TSource>The new generator.
Returns
- IGenerator<TSource>
A new generator
Type Parameters
TSource
The type of the source generator.
Exceptions
- ArgumentNullException
source
is null- ArgumentNullException
predicate
is null- ArgumentNullException
newGenerator
is null