IEnumerable<T>.TakeWhile Method
Overloads
| TakeWhile(Predicate<T>) |
Returns elements from the sequence as long as a specified condition is true. |
| TakeWhile(Func<T,Integer,Boolean>) |
Returns elements from the sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. |
Returns elements from the sequence as long as a specified condition is true.
function TakeWhile(const predicate: Predicate<T>): IEnumerable<T>
Parameters
- predicate
- Predicate<T>
A function to test each element for a condition.
Returns
A sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
Exceptions
predicate is nil .
Returns elements from the sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function.
function TakeWhile(const predicate: Func<T, Integer, Boolean>): IEnumerable<T>
Parameters
- predicate
- Func<T, Integer, Boolean>
A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
Returns
A sequence that contains elements from the input sequence that occur before the element at which the test no longer passes.
Exceptions
predicate is nil .