Table of Contents

Method Tuples

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

Tuples(int)

Generate all possible tuples of length n with digits 0 to n-1.

public static IEnumerable<int[]> Tuples(int n)

Parameters

n int

The length of tuples to generate. All digits are also between 0 and n-1.

Returns

IEnumerable<int[]>

Tuples<T>(IEnumerable<T>)

public static IEnumerable<T[]> Tuples<T>(this IEnumerable<T> list)

Parameters

list IEnumerable<T>

Returns

IEnumerable<T[]>

Type Parameters

T

Tuples<T>(int, Func<int[], T>)

Generates n-tuples of integers 0 to n-1 and applies the selector to them.

public static IEnumerable<T> Tuples<T>(int n, Func<int[], T> select)

Parameters

n int
select Func<int[], T>

Returns

IEnumerable<T>

Type Parameters

T

Exceptions

ArgumentOutOfRangeException

n;must be non negative