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