Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
public static System.Threading.Tasks.ValueTask<TResult> AggregateAsync<TSource,TAccumulate,TResult>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate,TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TAccumulate>> func, Func<TAccumulate,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TResult>> resultSelector, System.Threading.CancellationToken cancellationToken = default);
static member AggregateAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * 'Accumulate * Func<'Accumulate, 'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Accumulate>> * Func<'Accumulate, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Result>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Result>
<Extension()>
Public Function AggregateAsync(Of TSource, TAccumulate, TResult) (source As IAsyncEnumerable(Of TSource), seed As TAccumulate, func As Func(Of TAccumulate, TSource, CancellationToken, ValueTask(Of TAccumulate)), resultSelector As Func(Of TAccumulate, CancellationToken, ValueTask(Of TResult)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TResult)
The type of the elements of source.
The type of the accumulator value.
The type of the resulting value.
An IAsyncEnumerable<T> to aggregate over.
The initial accumulator value.
An accumulator function to be invoked on each element.
A function to transform the final accumulator value into the result value.
The CancellationToken to monitor for cancellation requests. The default is None.
The transformed final accumulator value.
resultSelector
is null
.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
public static System.Threading.Tasks.ValueTask<TResult> AggregateAsync<TSource,TAccumulate,TResult>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate,TSource,TAccumulate> func, Func<TAccumulate,TResult> resultSelector, System.Threading.CancellationToken cancellationToken = default);
static member AggregateAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * 'Accumulate * Func<'Accumulate, 'Source, 'Accumulate> * Func<'Accumulate, 'Result> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Result>
<Extension()>
Public Function AggregateAsync(Of TSource, TAccumulate, TResult) (source As IAsyncEnumerable(Of TSource), seed As TAccumulate, func As Func(Of TAccumulate, TSource, TAccumulate), resultSelector As Func(Of TAccumulate, TResult), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TResult)
The type of the elements of source.
The type of the accumulator value.
The type of the resulting value.
An IAsyncEnumerable<T> to aggregate over.
The initial accumulator value.
An accumulator function to be invoked on each element.
A function to transform the final accumulator value into the result value.
The CancellationToken to monitor for cancellation requests. The default is None.
The transformed final accumulator value.
resultSelector
is null
.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
public static System.Threading.Tasks.ValueTask<TAccumulate> AggregateAsync<TSource,TAccumulate>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate,TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TAccumulate>> func, System.Threading.CancellationToken cancellationToken = default);
static member AggregateAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * 'Accumulate * Func<'Accumulate, 'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Accumulate>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Accumulate>
<Extension()>
Public Function AggregateAsync(Of TSource, TAccumulate) (source As IAsyncEnumerable(Of TSource), seed As TAccumulate, func As Func(Of TAccumulate, TSource, CancellationToken, ValueTask(Of TAccumulate)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TAccumulate)
The type of the elements of source.
The type of the accumulator value.
An IAsyncEnumerable<T> to aggregate over.
The initial accumulator value.
An accumulator function to be invoked on each element.
The CancellationToken to monitor for cancellation requests. The default is None.
The final accumulator value.
func
is null
.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.
public static System.Threading.Tasks.ValueTask<TAccumulate> AggregateAsync<TSource,TAccumulate>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, TAccumulate seed, Func<TAccumulate,TSource,TAccumulate> func, System.Threading.CancellationToken cancellationToken = default);
static member AggregateAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * 'Accumulate * Func<'Accumulate, 'Source, 'Accumulate> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Accumulate>
<Extension()>
Public Function AggregateAsync(Of TSource, TAccumulate) (source As IAsyncEnumerable(Of TSource), seed As TAccumulate, func As Func(Of TAccumulate, TSource, TAccumulate), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TAccumulate)
The type of the elements of source.
The type of the accumulator value.
An IAsyncEnumerable<T> to aggregate over.
The initial accumulator value.
An accumulator function to be invoked on each element.
The CancellationToken to monitor for cancellation requests. The default is None.
The final accumulator value.
func
is null
.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Applies an accumulator function over a sequence.
public static System.Threading.Tasks.ValueTask<TSource> AggregateAsync<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TSource,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<TSource>> func, System.Threading.CancellationToken cancellationToken = default);
static member AggregateAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Source, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<'Source>> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Source>
<Extension()>
Public Function AggregateAsync(Of TSource) (source As IAsyncEnumerable(Of TSource), func As Func(Of TSource, TSource, CancellationToken, ValueTask(Of TSource)), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TSource)
The type of the elements of source.
An IAsyncEnumerable<T> to aggregate over.
An accumulator function to be invoked on each element.
The CancellationToken to monitor for cancellation requests. The default is None.
The final accumulator value.
func
is null
.
source
contains no elements.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Applies an accumulator function over a sequence.
public static System.Threading.Tasks.ValueTask<TSource> AggregateAsync<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, Func<TSource,TSource,TSource> func, System.Threading.CancellationToken cancellationToken = default);
static member AggregateAsync : System.Collections.Generic.IAsyncEnumerable<'Source> * Func<'Source, 'Source, 'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'Source>
<Extension()>
Public Function AggregateAsync(Of TSource) (source As IAsyncEnumerable(Of TSource), func As Func(Of TSource, TSource, TSource), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of TSource)
The type of the elements of source.
An IAsyncEnumerable<T> to aggregate over.
An accumulator function to be invoked on each element.
The CancellationToken to monitor for cancellation requests. The default is None.
The final accumulator value.
func
is null
.
source
contains no elements.
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided), 10 |
.NET Framework | 4.6.2 (package-provided), 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in