Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Files

Latest commit

72ebd64 · Sep 21, 2019

History

History
36 lines (20 loc) · 1.4 KB

partitions-2.md

File metadata and controls

36 lines (20 loc) · 1.4 KB

LINQ - Partition Operators

TakeWhile and SkipWhile partition an output sequence based a condition instead of a count of elements. You use these to limit the portion of an input sequence transferred to the output sequence.

TakeWhile syntax

This sample uses TakeWhile to return elements starting from the beginning of the array until a number is hit that is not less than 6.

Indexed TakeWhile

This sample uses TakeWhile to return elements starting from the beginning of the array until a number is hit that is less than its position in the array.

SkipWhile syntax

This sample uses SkipWhile to get the elements of the array starting from the first element divisible by 3.

Indexed SkipWhile

This sample uses SkipWhile to get the elements of the array starting from the first element less than its position.

Next: Ordering operations » Previous: Partitions «

Home