Enumerable.takeWhile Method
Returns elements from a sequence as long as a specified condition is true.
This method is static.
Parameters
- source
-
Type: IEnumerable
A sequence of to return elements from.
- 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.