Table of Contents

Method Sum

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

Sum(IGenerator<float>)

Makes a generator that will generate partial sums of a given generator.

public static IGenerator<float> Sum(this IGenerator<float> source)

Parameters

source IGenerator<float>

The generator.

Returns

IGenerator<float>

A new generator.

Examples

The following generator will generate 0f, 1f, 2f, 3f, 4f, 5f...

var generator = Generator.Constant(1f).Sum();

Exceptions

ArgumentNullException

source is null

Sum(IGenerator<int>)

Makes a generator that will generate partial sums of a given generator.

public static IGenerator<int> Sum(this IGenerator<int> source)

Parameters

source IGenerator<int>

The generator.

Returns

IGenerator<int>

A new generator.

Examples

The following generator will generate 0, 1, 2, 3, 4, 5...

var generator = Generator.Constant(1).Sum();

Exceptions

ArgumentNullException

source is null