IEnumerable<T>.LastOrDefault(T) Method
Returns the last element of a sequence, or the specified default value if the sequence contains no elements.
public function LastOrDefault(const defaultValue: T): T; overload;
Parameters
- defaultValue
- Type: T
The value to return if the sequence contains no elements.
Return Value
Type: T
DefaultValue if the source sequence is empty; otherwise, the last element in the IEnumerable<T>.