AsyncEnumerable.SumAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
- Source:
- SumAsync.cs
Computes the sum of a sequence of values.
public static System.Threading.Tasks.ValueTask<float> SumAsync(this System.Collections.Generic.IAsyncEnumerable<float> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<single> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<single>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Single), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Single)
Parameters
- source
- IAsyncEnumerable<Single>
A sequence of values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of nullable values.
public static System.Threading.Tasks.ValueTask<long?> SumAsync(this System.Collections.Generic.IAsyncEnumerable<long?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<Nullable<int64>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Nullable<int64>>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Nullable(Of Long)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Nullable(Of Long))
Parameters
- source
- IAsyncEnumerable<Nullable<Int64>>
A sequence of nullable values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
The sum is larger than MaxValue.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of nullable values.
public static System.Threading.Tasks.ValueTask<int?> SumAsync(this System.Collections.Generic.IAsyncEnumerable<int?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<Nullable<int>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Nullable<int>>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Nullable(Of Integer)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Nullable(Of Integer))
Parameters
- source
- IAsyncEnumerable<Nullable<Int32>>
A sequence of nullable values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
The sum is larger than MaxValue.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of nullable values.
public static System.Threading.Tasks.ValueTask<double?> SumAsync(this System.Collections.Generic.IAsyncEnumerable<double?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<Nullable<double>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Nullable<double>>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Nullable(Of Double)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Nullable(Of Double))
Parameters
- source
- IAsyncEnumerable<Nullable<Double>>
A sequence of nullable values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of nullable values.
public static System.Threading.Tasks.ValueTask<float?> SumAsync(this System.Collections.Generic.IAsyncEnumerable<float?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<Nullable<single>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Nullable<single>>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Nullable(Of Single)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Nullable(Of Single))
Parameters
- source
- IAsyncEnumerable<Nullable<Single>>
A sequence of nullable values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of values.
public static System.Threading.Tasks.ValueTask<long> SumAsync(this System.Collections.Generic.IAsyncEnumerable<long> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<int64> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<int64>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Long), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Long)
Parameters
- source
- IAsyncEnumerable<Int64>
A sequence of values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
The sum is larger than MaxValue.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of values.
public static System.Threading.Tasks.ValueTask<int> SumAsync(this System.Collections.Generic.IAsyncEnumerable<int> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<int>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Integer)
Parameters
- source
- IAsyncEnumerable<Int32>
A sequence of values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
The sum is larger than MaxValue.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of values.
public static System.Threading.Tasks.ValueTask<double> SumAsync(this System.Collections.Generic.IAsyncEnumerable<double> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<double> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<double>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Double), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Double)
Parameters
- source
- IAsyncEnumerable<Double>
A sequence of values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of values.
public static System.Threading.Tasks.ValueTask<decimal> SumAsync(this System.Collections.Generic.IAsyncEnumerable<decimal> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<decimal> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<decimal>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Decimal), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Decimal)
Parameters
- source
- IAsyncEnumerable<Decimal>
A sequence of values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- SumAsync.cs
Computes the sum of a sequence of nullable values.
public static System.Threading.Tasks.ValueTask<decimal?> SumAsync(this System.Collections.Generic.IAsyncEnumerable<decimal?> source, System.Threading.CancellationToken cancellationToken = default);
static member SumAsync : System.Collections.Generic.IAsyncEnumerable<Nullable<decimal>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Nullable<decimal>>
<Extension()>
Public Function SumAsync (source As IAsyncEnumerable(Of Nullable(Of Decimal)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Nullable(Of Decimal))
Parameters
- source
- IAsyncEnumerable<Nullable<Decimal>>
A sequence of nullable values to calculate the sum of.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The sum of the values in the sequence.
Exceptions
source
is null
.
Applies to
.NET 10 та інші версії
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
Відгук про .NET
.NET – це проект із відкритим кодом. Виберіть посилання, щоб надати відгук: