ListExtensions.FirstNonNull<T>

Extension Method in ListExtensions

Declaration

public static T FirstNonNull<T>(this List<T> list)
    where T : class

Description

Returns the first non-null item in the list.

Type Parameters

TThe type of the list.

Parameters

listThe list to get the item from.

Returns

TThe first non-null item in the list, or default(T) if all items are null.