Table of Contents

Method Pad

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

Pad<TSource>(IGenerator<TSource>, IEnumerable<TSource>)

Pads the specified generator with elements from a given list.

public static IGenerator<TSource> Pad<TSource>(this IGenerator<TSource> generator, IEnumerable<TSource> padding)

Parameters

generator IGenerator<TSource>

The source generator.

padding IEnumerable<TSource>

The padding.

Returns

IGenerator<TSource>

IGenerator<TSource>.

Type Parameters

TSource

The type of elements to generate.

Examples

var paddedGenerator = Generator.Count(4).Pad(new List(){7, 8});
//will generate 7 8 0 1 2 3 0 1 2 3...

Exceptions

ArgumentNullException

generator is null.

ArgumentNullException

padding is null.

Pad<TSource>(IGenerator<TSource>, TSource, int)

Pads the specified generator with a constant element repeated a specified number of times.

public static IGenerator<TSource> Pad<TSource>(this IGenerator<TSource> generator, TSource padding, int padCount)

Parameters

generator IGenerator<TSource>

The source generator.

padding TSource

The padding value.

padCount int

The number of values to pad.

Returns

IGenerator<TSource>

A new generator.

Type Parameters

TSource

The type of elements to generate.

Examples

var generator = Generator.Count(4).Pad(0, 3);
//will generate 0 0 0 0 1 2 0 1 2 ...