Enumerable.FirstOrDefault<'TSource> Method (IEnumerable<'TSource>, Func<'TSource, Boolean>)
Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.
Assembly: System.Core (in System.Core.dll)
static member FirstOrDefault<'TSource> : source:IEnumerable<'TSource> * predicate:Func<'TSource, bool> -> 'TSource
An IEnumerable<'T> to return an element from.
default(TSource) if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate.
The type of the elements of source.
The default value for reference and nullable types is null.
Available since 8
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1