ListExtensions.First<T>
Extension Method in ListExtensions
Declaration
public static T First<T>(this List<T> list)Description
Returns the first item in the list.
Type Parameters
| T | The type of the list. |
Parameters
| list | The list to get the item from. |
Returns
| T | The first item in the list, or default(T) if the list is empty. |
Overload
Declaration
public static T First<T>(this List<T> list, Predicate<T> predicate)Description
Returns the first 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 first item in the list that satisfies the predicate, or default(T) if no item satisfies the predicate. |