Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: T FirstOrDefault<T>(this IQueryable<T>, T)

Declaration

public static T FirstOrDefault<T>(
    this IQueryable<T> source,
    T default
)

Summary

Returns the first element of a sequence, or a default value if the sequence contains no elements.

Generic type parameters

TThe type of the elements of source.

Parameters

this IQueryable<T>sourceThe collection to return the first element of.
TdefaultThe default value to return if the sequence contains no elements.

Returns

default if source is empty; otherwise, the first element in source.