Click or drag to resize

GeneratorIterateTSource Method (TSource, FuncTSource, TSource)

Makes a generator that returns iterations of the specified initial element.

Namespace:  Gamelogic.Extensions.Algorithms
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static IGenerator<TSource> Iterate<TSource>(
	TSource initialElement,
	Func<TSource, TSource> iterator
)

Parameters

initialElement
Type: TSource
The initial element.
iterator
Type: SystemFuncTSource, TSource
The iteration function.

Type Parameters

TSource
The type of the source generator.

Return Value

Type: IGeneratorTSource
IGenerator<TSource>.
Exceptions
ExceptionCondition
ArgumentNullExceptioniterator
Remarks
If the iteration function is f and the initial element is x, then the result generator wil generate x, f(x), f(f(x)), f(f(f(x))), ...
See Also