Method SumAsync
| MongoDB CSharp Driver API Reference (original) (raw)
Namespace
Assembly
MongoDB.Driver.dll
SumAsync(IQueryable, CancellationToken)
Computes the sum of a sequence of decimal values.
public static Task<decimal> SumAsync(this IQueryable<decimal> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<decimal>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable<decimal?>, CancellationToken)
Computes the sum of a sequence of Nullable values.
public static Task<decimal?> SumAsync(this IQueryable<decimal?> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<decimal?>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable, CancellationToken)
Computes the sum of a sequence of double values.
public static Task<double> SumAsync(this IQueryable<double> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<double>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable<double?>, CancellationToken)
Computes the sum of a sequence of Nullable values.
public static Task<double?> SumAsync(this IQueryable<double?> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<double?>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable, CancellationToken)
Computes the sum of a sequence of float values.
public static Task<float> SumAsync(this IQueryable<float> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<float>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable<float?>, CancellationToken)
Computes the sum of a sequence of Nullable values.
public static Task<float?> SumAsync(this IQueryable<float?> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<float?>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable, CancellationToken)
Computes the sum of a sequence of int values.
public static Task<int> SumAsync(this IQueryable<int> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<int>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable<int?>, CancellationToken)
Computes the sum of a sequence of Nullable values.
public static Task<int?> SumAsync(this IQueryable<int?> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<int?>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable, CancellationToken)
Computes the sum of a sequence of long values.
public static Task<long> SumAsync(this IQueryable<long> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<long>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable<long?>, CancellationToken)
Computes the sum of a sequence of Nullable values.
public static Task<long?> SumAsync(this IQueryable<long?> source, CancellationToken cancellationToken = default)
Parameters
source
IQueryable<long?>
A sequence of values to calculate the sum of.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the values in the sequence.
SumAsync(IQueryable, Expression<Func<TSource, decimal>>, CancellationToken)
Computes the sum of the sequence of decimal values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<decimal> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, decimal>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, decimal?>>, CancellationToken)
Computes the sum of the sequence of Nullable values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<decimal?> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, decimal?>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, double>>, CancellationToken)
Computes the sum of the sequence of double values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<double> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, double>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, double?>>, CancellationToken)
Computes the sum of the sequence of Nullable values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<double?> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, double?>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, float>>, CancellationToken)
Computes the sum of the sequence of float values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<float> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, float>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, float?>>, CancellationToken)
Computes the sum of the sequence of Nullable values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<float?> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, float?>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, int>>, CancellationToken)
Computes the sum of the sequence of int values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<int> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, int>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, int?>>, CancellationToken)
Computes the sum of the sequence of Nullable values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<int?> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, int?>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, long>>, CancellationToken)
Computes the sum of the sequence of long values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<long> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, long>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.
SumAsync(IQueryable, Expression<Func<TSource, long?>>, CancellationToken)
Computes the sum of the sequence of Nullable values that is obtained by invoking a projection function on each element of the input sequence.
public static Task<long?> SumAsync<TSource>(this IQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken = default)
Parameters
source
IQueryable
A sequence of values.
selector
Expression<Func<TSource, long?>>
A projection function to apply to each element.
cancellationToken
CancellationToken
The cancellation token.
Returns
The sum of the projected values.
Type Parameters
TSource
The type of the elements of source
.