IEnumerable<T>.LastOrDefault(TPredicate<T>) Method
Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.
public function LastOrDefault(const predicate: TPredicate<T>): T; overload;
Parameters
- predicate
- Type: TPredicate<T>
A function to test each element for a condition.
Return Value
Type: T
Default(T) 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.