 | GeneratorIterateTSource Method (TSource, TSource, FuncTSource, 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,
Func<TSource, TSource, TSource> iterator
)
Parameters
- initialElement0
- Type: TSource
The first element to generate. - initialElement1
- Type: TSource
The second element to generate. - iterator
- Type: SystemFuncTSource, 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 two items generated to produce the next one.
The first two elements are provided by the caller.
For example,
Iterate(0, 1, (x, y) => x + y);
make a generator that produces the Fibonacci numbers.
See Also