Grouping.Partition Method

Definition

Namespace: Extreme.DataAnalysis
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

Partition(IList<Int32>) Constructs a grouping that represents a collection of non-overlapping chunks of fixed length.
Partition(Int32, Int32) Constructs a grouping that represents a collection of non-overlapping chunks of fixed length.
Partition<T>(IList<T>, Int32, Boolean, Boolean) Constructs a grouping that represents a collection of non-overlapping chunks of fixed length.

Partition(IList<Int32>)

Constructs a grouping that represents a collection of non-overlapping chunks of fixed length.
C#
public static Grouping<int> Partition(
	IList<int> offsets
)

Parameters

offsets  IList<Int32>
Integer array containing the offsets of the partition boundaries.

Return Value

Grouping<Int32>
A grouping object that represents the chunking.

Exceptions

Partition(Int32, Int32)

Constructs a grouping that represents a collection of non-overlapping chunks of fixed length.
C#
public static Grouping<int> Partition(
	int length,
	int size
)

Parameters

length  Int32
The total length of all groups.
size  Int32
The size of each group.

Return Value

Grouping<Int32>
A grouping object that represents the chunking.

Partition<T>(IList<T>, Int32, Boolean, Boolean)

Constructs a grouping that represents a collection of non-overlapping chunks of fixed length.
C#
public static Grouping<T> Partition<T>(
	IList<T> values,
	int size,
	bool alignToEnd = false,
	bool skipIncomplete = false
)

Parameters

values  IList<T>
The collection the grouping is over.
size  Int32
The size of the chunks. Must be greater than zero.
alignToEnd  Boolean  (Optional)
Indicates whether groups should be aligned starting from the end of the index.
skipIncomplete  Boolean  (Optional)
Indicates whether the first or last group should be skipped if it does not have full size.

Type Parameters

T

Return Value

Grouping<T>
A grouping object that represents the chunking.

Remarks

If alignToEnd is false (the default) then first element of values in each group is used as the key for the group. If alignToEnd is true then the last element of values in each group is used as the key for the group.

Exceptions

ArgumentNullException

values is null

ArgumentOutOfRangeException

size is less than or equal to zero.

See Also