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.

TakeWhile(Predicate<T>)

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

Delphi
function TakeWhile(const predicate: Predicate<T>): IEnumerable<T>

Parameters

predicate
Predicate<T>

A function to test each element for a condition.

Returns

IEnumerable<T>

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 .

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.

Delphi
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

IEnumerable<T>

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 .