 | GeneratorIterateTSource Method (TSource, TSource, TSource, FuncTSource, TSource, TSource, TSource) |
Makes a generator that uses an iterator function to generate elements.
Namespace:
Gamelogic.Extensions.Algorithms
Assembly:
Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntaxpublic static IGenerator<TSource> Iterate<TSource>(
TSource initialElement0,
TSource initialElement1,
TSource initialElement2,
Func<TSource, TSource, TSource, TSource> iterator
)
Parameters
- initialElement0
- Type: TSource
The first element to generate. - initialElement1
- Type: TSource
The second element to generate. - initialElement2
- Type: TSource
The third element to generate. - iterator
- Type: SystemFuncTSource, TSource, TSource, TSource
The iterator function.
Type Parameters
- TSource
- The type of the t source.
Return Value
Type:
IGeneratorTSource
Exceptions
RemarksThe iterator function is applied the last three items generated to produce the next one.
The first three elements are provided by the caller.
For example,
Iterate(0, 0, 1, (x, y, z) => x + y + z);
make a generator that produces the Tribonacci numbers.
See Also