.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

XPQueryExtensions.FirstOrDefaultAsync Method

Name Parameters Description
FirstOrDefaultAsync<T>(IQueryable<T>, CancellationToken) static query, cancellationToken

Asynchronously gets the first object in a selection. If the selection is empty, returns a default value for <T>.

FirstOrDefaultAsync<T>(IQueryable<T>, Expression<Func<T, Boolean>>, CancellationToken) static query, predicate, cancellationToken

Asynchronously gets the first object that meets specified requirements in a selection. If the selection is empty, returns a default value for <T>.