QueryableExtensions.SumAsync Method
Asynchronously computes the sum of a sequence of Decimal values.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() ![]() | SumAsync(IQueryable<Decimal>) | Asynchronously computes the sum of a sequence of Decimal values. |
![]() ![]() | SumAsync(IQueryable<Decimal>, CancellationToken) | Asynchronously computes the sum of a sequence of Decimal values. |
![]() ![]() | SumAsync(IQueryable<Double>) | Asynchronously computes the sum of a sequence of Double values. |
![]() ![]() | SumAsync(IQueryable<Double>, CancellationToken) | Asynchronously computes the sum of a sequence of Double values. |
![]() ![]() | SumAsync(IQueryable<Int32>) | Asynchronously computes the sum of a sequence of Int32 values. |
![]() ![]() | SumAsync(IQueryable<Int32>, CancellationToken) | Asynchronously computes the sum of a sequence of Int32 values. |
![]() ![]() | SumAsync(IQueryable<Int64>) | Asynchronously computes the sum of a sequence of Int64 values. |
![]() ![]() | SumAsync(IQueryable<Int64>, CancellationToken) | Asynchronously computes the sum of a sequence of Int64 values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Decimal>>) | Asynchronously computes the sum of a sequence of nullable Decimal values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Decimal>>, CancellationToken) | Asynchronously computes the sum of a sequence of nullable Decimal values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Double>>) | Asynchronously computes the sum of a sequence of nullable Double values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Double>>, CancellationToken) | Asynchronously computes the sum of a sequence of nullable Double values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Int32>>) | Asynchronously computes the sum of a sequence of nullable Int32 values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Int32>>, CancellationToken) | Asynchronously computes the sum of a sequence of nullable Int32 values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Int64>>) | Asynchronously computes the sum of a sequence of nullable Int64 values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Int64>>, CancellationToken) | Asynchronously computes the sum of a sequence of nullable Int64 values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Single>>) | Asynchronously computes the sum of a sequence of nullable Single values. |
![]() ![]() | SumAsync(IQueryable<Nullable<Single>>, CancellationToken) | Asynchronously computes the sum of a sequence of nullable Single values. |
![]() ![]() | SumAsync(IQueryable<Single>) | Asynchronously computes the sum of a sequence of Single values. |
![]() ![]() | SumAsync(IQueryable<Single>, CancellationToken) | Asynchronously computes the sum of a sequence of Single values. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Decimal>>) | Asynchronously computes the sum of the sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Decimal>>, CancellationToken) | Asynchronously computes the sum of the sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Double>>) | Asynchronously computes the sum of the sequence of Double values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Double>>, CancellationToken) | Asynchronously computes the sum of the sequence of Double values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int32>>) | Asynchronously computes the sum of the sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int32>>, CancellationToken) | Asynchronously computes the sum of the sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int64>>) | Asynchronously computes the sum of the sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int64>>, CancellationToken) | Asynchronously computes the sum of the sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Decimal>>>) | Asynchronously computes the sum of the sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Decimal>>>, CancellationToken) | Asynchronously computes the sum of the sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Double>>>) | Asynchronously computes the sum of the sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Double>>>, CancellationToken) | Asynchronously computes the sum of the sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int32>>>) | Asynchronously computes the sum of the sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int32>>>, CancellationToken) | Asynchronously computes the sum of the sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int64>>>) | Asynchronously computes the sum of the sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int64>>>, CancellationToken) | Asynchronously computes the sum of the sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Single>>>) | Asynchronously computes the sum of the sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Single>>>, CancellationToken) | Asynchronously computes the sum of the sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Single>>) | Asynchronously computes the sum of the sequence of Single values that is obtained by invoking a projection function on each element of the input sequence. |
![]() ![]() | SumAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Single>>, CancellationToken) | Asynchronously computes the sum of the sequence of Single values that is obtained by invoking a projection function on each element of the input sequence. |
QueryableExtensions.SumAsync Method (IQueryable<Decimal>)
Asynchronously computes the sum of a sequence of Decimal values.
Parameters
- source
-
Type:
System.Linq.IQueryable<Decimal>
A sequence of Decimal values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Decimal>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Decimal>, CancellationToken)
Asynchronously computes the sum of a sequence of Decimal values.
public static Task<decimal> SumAsync( this IQueryable<decimal> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Decimal>
A sequence of Decimal values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Decimal>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Double>)
Asynchronously computes the sum of a sequence of Double values.
Parameters
- source
-
Type:
System.Linq.IQueryable<Double>
A sequence of Double values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Double>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Double>, CancellationToken)
Asynchronously computes the sum of a sequence of Double values.
public static Task<double> SumAsync( this IQueryable<double> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Double>
A sequence of Double values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Double>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Int32>)
Asynchronously computes the sum of a sequence of Int32 values.
Parameters
- source
-
Type:
System.Linq.IQueryable<Int32>
A sequence of Int32 values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Int32>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Int32>, CancellationToken)
Asynchronously computes the sum of a sequence of Int32 values.
public static Task<int> SumAsync( this IQueryable<int> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Int32>
A sequence of Int32 values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Int32>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Int64>)
Asynchronously computes the sum of a sequence of Int64 values.
Parameters
- source
-
Type:
System.Linq.IQueryable<Int64>
A sequence of Int64 values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Int64>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Int64>, CancellationToken)
Asynchronously computes the sum of a sequence of Int64 values.
public static Task<long> SumAsync( this IQueryable<long> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Int64>
A sequence of Int64 values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Int64>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Decimal>>)
Asynchronously computes the sum of a sequence of nullable Decimal values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<decimal>> SumAsync( this IQueryable<Nullable<decimal>> source )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Decimal>>
A sequence of nullable Decimal values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Decimal>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Decimal>>, CancellationToken)
Asynchronously computes the sum of a sequence of nullable Decimal values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<decimal>> SumAsync( this IQueryable<Nullable<decimal>> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Decimal>>
A sequence of nullable Decimal values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Decimal>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Double>>)
Asynchronously computes the sum of a sequence of nullable Double values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<double>> SumAsync( this IQueryable<Nullable<double>> source )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Double>>
A sequence of nullable Double values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Double>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Double>>, CancellationToken)
Asynchronously computes the sum of a sequence of nullable Double values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<double>> SumAsync( this IQueryable<Nullable<double>> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Double>>
A sequence of nullable Double values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Double>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Int32>>)
Asynchronously computes the sum of a sequence of nullable Int32 values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<int>> SumAsync( this IQueryable<Nullable<int>> source )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Int32>>
A sequence of nullable Int32 values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Int32>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Int32>>, CancellationToken)
Asynchronously computes the sum of a sequence of nullable Int32 values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<int>> SumAsync( this IQueryable<Nullable<int>> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Int32>>
A sequence of nullable Int32 values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Int32>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Int64>>)
Asynchronously computes the sum of a sequence of nullable Int64 values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<long>> SumAsync( this IQueryable<Nullable<long>> source )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Int64>>
A sequence of nullable Int64 values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Int64>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Int64>>, CancellationToken)
Asynchronously computes the sum of a sequence of nullable Int64 values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<long>> SumAsync( this IQueryable<Nullable<long>> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Int64>>
A sequence of nullable Int64 values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Int64>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Single>>)
Asynchronously computes the sum of a sequence of nullable Single values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<float>> SumAsync( this IQueryable<Nullable<float>> source )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Single>>
A sequence of nullable Single values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Single>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Nullable<Single>>, CancellationToken)
Asynchronously computes the sum of a sequence of nullable Single values.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<float>> SumAsync( this IQueryable<Nullable<float>> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Nullable<Single>>
A sequence of nullable Single values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Single>>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Single>)
Asynchronously computes the sum of a sequence of Single values.
Parameters
- source
-
Type:
System.Linq.IQueryable<Single>
A sequence of Single values to calculate the sum of.
Return Value
Type: System.Threading.Tasks.Task<Single>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync Method (IQueryable<Single>, CancellationToken)
Asynchronously computes the sum of a sequence of Single values.
public static Task<float> SumAsync( this IQueryable<float> source, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<Single>
A sequence of Single values to calculate the sum of.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Single>A task that represents the asynchronous operation. The task result contains the sum of the values in the sequence.
Exception | Condition |
---|---|
ArgumentNullException | source is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Decimal>>)
Asynchronously computes the sum of the sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<decimal> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Decimal>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Decimal>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Decimal>>, CancellationToken)
Asynchronously computes the sum of the sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] [SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public static Task<decimal> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Decimal>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Decimal>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Double>>)
Asynchronously computes the sum of the sequence of Double values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<double> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, double>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Double>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Double>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Double>>, CancellationToken)
Asynchronously computes the sum of the sequence of Double values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<double> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Double>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Double>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Int32>>)
Asynchronously computes the sum of the sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<int> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, int>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Int32>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Int32>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Int32>>, CancellationToken)
Asynchronously computes the sum of the sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<int> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Int32>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Int32>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Int64>>)
Asynchronously computes the sum of the sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<long> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, long>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Int64>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Int64>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Int64>>, CancellationToken)
Asynchronously computes the sum of the sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] [SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public static Task<long> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Int64>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Int64>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Decimal>>>)
Asynchronously computes the sum of the sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<decimal>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<decimal>>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Decimal>>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Decimal>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Decimal>>>, CancellationToken)
Asynchronously computes the sum of the sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<decimal>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<decimal>>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Decimal>>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Decimal>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Double>>>)
Asynchronously computes the sum of the sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<double>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<double>>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Double>>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Double>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Double>>>, CancellationToken)
Asynchronously computes the sum of the sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<double>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<double>>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Double>>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Double>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Int32>>>)
Asynchronously computes the sum of the sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<int>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<int>>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Int32>>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Int32>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Int32>>>, CancellationToken)
Asynchronously computes the sum of the sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<int>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<int>>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Int32>>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Int32>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Int64>>>)
Asynchronously computes the sum of the sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<long>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<long>>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Int64>>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Int64>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Int64>>>, CancellationToken)
Asynchronously computes the sum of the sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] [SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public static Task<Nullable<long>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<long>>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Int64>>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Int64>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
OverflowException | The number of elements in source is larger than MaxValue . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Single>>>)
Asynchronously computes the sum of the sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<float>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<float>>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Single>>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Single>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Single>>>, CancellationToken)
Asynchronously computes the sum of the sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] [SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<Nullable<float>> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, Nullable<float>>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Nullable<Single>>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Nullable<Single>>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Single>>)
Asynchronously computes the sum of the sequence of Single values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public static Task<float> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, float>> selector )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Single>>
A projection function to apply to each element.
Return Value
Type: System.Threading.Tasks.Task<Single>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.
QueryableExtensions.SumAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Single>>, CancellationToken)
Asynchronously computes the sum of the sequence of Single values that is obtained by invoking a projection function on each element of the input sequence.
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] [SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public static Task<float> SumAsync<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken )
Parameters
- source
-
Type:
System.Linq.IQueryable<TSource>
A sequence of values of type TSource .
- selector
-
Type:
System.Linq.Expressions.Expression<Func<TSource, Single>>
A projection function to apply to each element.
- cancellationToken
-
Type:
System.Threading.CancellationToken
A CancellationToken to observe while waiting for the task to complete.
Return Value
Type: System.Threading.Tasks.Task<Single>A task that represents the asynchronous operation. The task result contains the sum of the projected values.
Type Parameters
- TSource
The type of the elements of source .
Exception | Condition |
---|---|
ArgumentNullException | source or selector is null . |
InvalidOperationException | source does not implement IDbAsyncQueryProvider . |
Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.