IEnumerable.takeWhile Method

Returns elements from a sequence as long as a specified condition is true.
 

Parameters

predicate

Type: Function
A function to test each source element for a condition; the second parameter of the function represents the index of the source element.

Return Value


Type: IEnumerable
An enumerable that contains elements from the input sequence that occur before the element at which the test no longer passes.