Iterators.Combinations<T>(IList<T>, Int32) Method

Enumerates all combinations of the specified length from a set of items.

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public static IEnumerable<T[]> Combinations<T>(
	IList<T> items,
	int length
)

Parameters

items  IList<T>
A list of items to draw combinations from.
length  Int32
The length of the combinations.

Type Parameters

T
The type of the items.

Return Value

IEnumerable<T[]>
A sequence of arrays that contain all combinations of length elements from items.

Exceptions

ArgumentNullException

items is null.

ArgumentOutOfRangeException

length is less than zero.

See Also