Overview

A partitioning operation divides an input set into two sections, without rearranging the elements, and then returning one of the sections.

Partitioning operations have no query syntax.

methods

MethodDescription
SkipSkips elements up to a specified position in the collection
SkipWhileSkips elements based on a predicate function until an element does not satisfy the condition
TakeTakes elements up to a specified position in a collection
TakeWhileTakes elements based on a predicate function until an element does not satisfy the condition
ChunkSplits elements of a collection into chunks of a specified maximum size

examples

Assume some sequence: 0 1 2 3 4 5 6 7

  • Take(3) returns 0 1 2
  • Skip(3) returns 3 4 5 6 7
  • TakeWhile(n => n < 5) returns 0 1 2 3 4
  • SkipWhile(n => n < 5) returns 5 6 7
  • Chunk(3) returns [0, 1, 2], [3, 4 5], [6, 7]