ListExtensions.Last<T>
Extension Method in ListExtensions
Declaration
public static T Last<T>(this List<T> list)
Description
Returns the last item in the list.
Type Parameters
T | The type of the list. |
Parameters
list | The list to get the item from. |
Returns
T | The last item in the list, or default(T) if the list is empty. |
Overload
Declaration
public static T Last<T>(this List<T> list, Predicate<T> predicate)
Description
Returns the last item in the list that satisfies a predicate.
Type Parameters
T | The type of the list. |
Parameters
list | The list to get the item from. |
predicate | The predicate to use. |
Returns
T | The last item in the list that satisfies the predicate, or default(T) if no item satisfies the predicate. |