Skip to main content
.NET 8.0+

XPQueryExtensions.MaxAsync<T, TResult>(IQueryable<T>, Expression<Func<T, TResult>>, CancellationToken) Method

Asynchronously gets the maximum value from a specified query. Uses a lambda expression to obtain values.

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.2.dll

Declaration

public static Task<TResult> MaxAsync<T, TResult>(
    this IQueryable<T> query,
    Expression<Func<T, TResult>> selector,
    CancellationToken cancellationToken = default(CancellationToken)
)

Parameters

Name Type Description
query IQueryable<T>

An XPQuery<T> that specifies a persistent object selection.

selector Expression<Func<T, TResult>>

A lambda expression that gets a value from a persistent object.

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken null

A CancellationToken object that delivers a cancellation notice to the running operation.

Type Parameters

Name
T
TResult

Returns

Type Description
Task<TResult>

A Task that returns an object. This object is the maximum value.

See Also