Grouping.VariablePartition<T> Method

Constructs a grouping that represents a collection of non-overlapping chunks based on the specified condition.


Namespace: Extreme.DataAnalysis
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
public static Grouping<T> VariablePartition<T>(
	IList<T> index,
	Func<T, T, bool> condition,
	Direction direction = Direction.Forward


index  IList<T>
The index the grouping is over.
condition  Func<T, T, Boolean>
A delegate that indicates whether two keys are in the same window.
direction  Direction  (Optional)
The direction in which index is traversed to validate the condition.

Type Parameters


Return Value



The extent of each chunk is determined by the first key value and condition. The window is extended as long as condition returns true whe applied to the first key and the subsequent keys.

The direction parameter determines whether chunks are created and extended from the beginning (forward) or the end (backward). The grouping is still in the original order even if going backward.

See Also