IEnumerable<T>.LastOrDefault(TPredicate<T>,T) Method

Returns the last element of a sequence that satisfies a condition or the specified default value if no such element is found.

Namespace: Spring.Collections
 function LastOrDefault(const predicate: TPredicate<T>; const defaultValue: T): T; overload;


Type: TPredicate<T>

A function to test each element for a condition.

Type: T

The value to return if no element is found.

Return Value

Type: T

DefaultValue if the sequence is empty or if no elements pass the test in the predicate function; otherwise, the last element that passes the test in the predicate function.