 | GeneratorCombineT1, T2, TResult Method (IGeneratorT1, IGeneratorT2, FuncT1, T2, TResult) |
Combines the specified generators by applying a result selector
function to the elements of each generator.
Namespace:
Gamelogic.Extensions.Algorithms
Assembly:
Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntaxpublic static IGenerator<TResult> Combine<T1, T2, TResult>(
IGenerator<T1> generator1,
IGenerator<T2> generator2,
Func<T1, T2, TResult> resultSelector
)
Parameters
- generator1
- Type: Gamelogic.Extensions.AlgorithmsIGeneratorT1
The first generator. - generator2
- Type: Gamelogic.Extensions.AlgorithmsIGeneratorT2
The second generator. - resultSelector
- Type: SystemFuncT1, T2, TResult
The result selector function.
Type Parameters
- T1
- The type of elements of the first generator.
- T2
- The type of elements of the second generator.
- TResult
- The type of the elements of the result generator.
Return Value
Type:
IGeneratorTResultA new generator
Exceptions
ExamplesThe following will code will add the elements of two generators to form its elements.
var generator1 = Generator.Count(3);
var generator2 = Generator.Count(2);
var generator = Generator.Combine(generator1, generator2, (x, y) => x + y);
See Also