IEnumerable<T>.TryGetLast Method

Overloads

TryGetLast(T)

Attempts to get the last element in the sequence.

TryGetLast(T, Predicate<T>)

Attempts to get the last element in the sequence that satisfies a specified condition.

TryGetLast(T)

Attempts to get the last element in the sequence.

Delphi
function TryGetLast(var value: T): Boolean

Parameters

value
T

The last element in the sequence.

Returns

Boolean

True if the sequence was not empty; otherwise, False .

TryGetLast(T, Predicate<T>)

Attempts to get the last element in the sequence that satisfies a specified condition.

Delphi
function TryGetLast(var value: T; const predicate: Predicate<T>): Boolean

Parameters

value
T

The last element in the sequence that passes the test in the specified predicate function.

predicate
Predicate<T>

A function to test each element for a condition.

Returns

Boolean

True if an element in the sequence satiesfies the condition in predicate ; otherwise, False .

Exceptions

predicate is nil .