Back to Devexpress

XPQueryExtensions.SumAsync<T>(IQueryable<T>, Expression<Func<T, Int64>>, 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-int64-system-dot-threading-dot-cancellationtoken-x29.md

latest2.9 KB
Original Source

XPQueryExtensions.SumAsync<T>(IQueryable<T>, Expression<Func<T, Int64>>, 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<long> SumAsync<T>(
    this IQueryable<T> query,
    Expression<Func<T, long>> 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, Long)),
    cancellationToken As CancellationToken = Nothing
) As Task(Of Long)

Parameters

NameTypeDescription
queryIQueryable<T>

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

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

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<Int64>

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

|

See Also

XPQueryExtensions Class

XPQueryExtensions Members

DevExpress.Xpo Namespace