Iterators.Combinations Method
Definition
Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.2
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.2
Overload List
Combinations( | Enumerates the indexes of all combinations of the specified length from a set of the specified size. |
Combinations( | Enumerates the indexes of all combinations of the specified length from a set of the specified size. |
Combinations<T>(IList<T>, Int32) | Enumerates all combinations of the specified length from a set of items. |
Combinations<T>(IList<T>, Int32)
Enumerates all combinations of the specified length from a set of items.
public static IEnumerable<T[]> Combinations<T>(
IList<T> items,
int length
)
Parameters
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
Argument | items is null. |
Argument | length is less than zero. |
Combinations(Int32, Int32)
Enumerates the indexes of all combinations of the specified length
from a set of the specified size.
public static IEnumerable<int[]> Combinations(
int count,
int length
)
Parameters
- count Int32
- The size of the set to draw combinations from.
- length Int32
- The length of the combinations.
Return Value
IEnumerable<Int32[]>A sequence of integer arrays that contain the indexes of all combinations of length elements from a set of size count.
Exceptions
Argument | length is less than zero. |
Combinations(Int32, Int32, Int32[])
Enumerates the indexes of all combinations of the specified length
from a set of the specified size.
public static IEnumerable<int[]> Combinations(
int count,
int length,
int[] result
)
Parameters
- count Int32
- The size of the set to draw combinations from.
- length Int32
- The length of the combinations.
- result Int32[]
- An array that is to hold the result.
Return Value
IEnumerable<Int32[]>A sequence of integer arrays that contain the indexes of all combinations of length elements from a set of size count.
Remarks
The indexes are returned each time in the same array, result. Its elements should not be modified. If they are modified, the results are unpredictable.
Exceptions
Argument | length is less than zero. |