Click or drag to resize

GeneratorLogTSource Method (IGeneratorTSource, ActionTSource)

A generator that generates the elements of the source generator, but applies a log function to each element as it is generated.

Namespace:  Gamelogic.Extensions.Algorithms
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static IGenerator<TSource> Log<TSource>(
	this IGenerator<TSource> generator,
	Action<TSource> log
)

Parameters

generator
Type: Gamelogic.Extensions.AlgorithmsIGeneratorTSource
The generator.
log
Type: SystemActionTSource
The log.

Type Parameters

TSource
The type of the source generator.

Return Value

Type: IGeneratorTSource
IGenerator<TSource>.

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).
Remarks
This generator is useful for debugging, to inspect the results of a internal generator. It should not be used for other purposes. (Generators should generally not have side effects).
Examples
var generator = Generator.Count(4).Log(x => Debug.Log(x.ToString())).Select(x => 2*x);
See Also