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.
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.
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.
This sample uses SkipWhile
to get the elements of the array starting from the first element divisible by 3.
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 «