Click or drag to resize

GeneratorSwitchWhenTSource Method

Generates elements from the source generator until a condition is met, then generate elements from a second generator.

Namespace:  Gamelogic.Extensions.Algorithms
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static IGenerator<TSource> SwitchWhen<TSource>(
	this IGenerator<TSource> source,
	Func<TSource, bool> predicate,
	IGenerator<TSource> newGenerator
)

Parameters

source
Type: Gamelogic.Extensions.AlgorithmsIGeneratorTSource
The source.
predicate
Type: SystemFuncTSource, Boolean
The predicate.
newGenerator
Type: Gamelogic.Extensions.AlgorithmsIGeneratorTSource
The new generator.

Type Parameters

TSource
The type of the source generator.

Return Value

Type: IGeneratorTSource
A new generator

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IGeneratorTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptionsource is null
ArgumentNullExceptionpredicate is null
ArgumentNullExceptionnewGenerator is null
See Also