Back to Devexpress

XPQueryExtensions.SumAsync<T>(IQueryable<T>, Expression<Func<T, Decimal>>, CancellationToken) Method

xpo-devexpress-dot-xpo-dot-xpqueryextensions-dot-sumasync-1-x28-system-dot-linq-dot-iqueryable-0-system-dot-linq-dot-expressions-dot-expression-system-dot-func-0-system-dot-decimal-system-dot-threading-dot-cancellationtoken-x29.md

latest2.9 KB
Original Source

XPQueryExtensions.SumAsync<T>(IQueryable<T>, Expression<Func<T, Decimal>>, CancellationToken) Method

Asynchronously calculates a sum of objects’ specific Int64 fields for a query. Uses a lambda expression to obtain values.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public static Task<decimal> SumAsync<T>(
    this IQueryable<T> query,
    Expression<Func<T, decimal>> selector,
    CancellationToken cancellationToken = default(CancellationToken)
)
vb
<ExtensionAttribute>
Public Shared Function SumAsync(Of T)(
    query As IQueryable(Of T),
    selector As Expression(Of Func(Of T, Decimal)),
    cancellationToken As CancellationToken = Nothing
) As Task(Of Decimal)

Parameters

NameTypeDescription
queryIQueryable<T>

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

| | selector | Expression<Func<T, Decimal>> |

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

|

Optional Parameters

NameTypeDefaultDescription
cancellationTokenCancellationTokennull

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

|

Type Parameters

Name
T

Returns

TypeDescription
Task<Decimal>

A Task that returns a sum of objects’ specific Int64 fields for a query.

|

See Also

XPQueryExtensions Class

XPQueryExtensions Members

DevExpress.Xpo Namespace