Table of Contents

Method Log

Namespace
Gamelogic.Extensions.Algorithms
Assembly
Gamelogic.Extensions.dll

Log<TSource>(IGenerator<TSource>, Action<TSource>)

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

public static IGenerator<TSource> Log<TSource>(this IGenerator<TSource> generator, Action<TSource> log)

Parameters

generator IGenerator<TSource>

The generator.

log Action<TSource>

The log.

Returns

IGenerator<TSource>

IGenerator<TSource>.

Type Parameters

TSource

The type of the source generator.

Examples

var generator = Generator.Count(4).Log(x => Debug.Log(x.ToString())).Select(x => 2*x);

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).

Log<TSource>(IGenerator<TSource>)

A generator that generates the elements of the source generator, but also Logs the elements to the console.

public static IGenerator<TSource> Log<TSource>(this IGenerator<TSource> generator)

Parameters

generator IGenerator<TSource>

The base generator.

Returns

IGenerator<TSource>

Type Parameters

TSource

The type of the generator's items.