แก้ไข

แชร์ผ่าน


AsyncEnumerable.AggregateAsync Method

Definition

Overloads

AggregateAsync<TSource,TAccumulate,TResult>(IAsyncEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>, Func<TAccumulate,CancellationToken,ValueTask<TResult>>, CancellationToken)

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.

AggregateAsync<TSource,TAccumulate,TResult>(IAsyncEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, Func<TAccumulate, TResult>, CancellationToken)

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.

AggregateAsync<TSource,TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>, CancellationToken)

Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.

AggregateAsync<TSource,TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, CancellationToken)

Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.

AggregateAsync<TSource>(IAsyncEnumerable<TSource>, Func<TSource,TSource,CancellationToken,ValueTask<TSource>>, CancellationToken)

Applies an accumulator function over a sequence.

AggregateAsync<TSource>(IAsyncEnumerable<TSource>, Func<TSource,TSource,TSource>, CancellationToken)

Applies an accumulator function over a sequence.

AggregateAsync<TSource,TAccumulate,TResult>(IAsyncEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>, Func<TAccumulate,CancellationToken,ValueTask<TResult>>, CancellationToken)

Source:
AggregateAsync.cs

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)

Type Parameters

TSource

The type of the elements of source.

TAccumulate

The type of the accumulator value.

TResult

The type of the resulting value.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> to aggregate over.

seed
TAccumulate

The initial accumulator value.

func
Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>

An accumulator function to be invoked on each element.

resultSelector
Func<TAccumulate,CancellationToken,ValueTask<TResult>>

A function to transform the final accumulator value into the result value.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

The transformed final accumulator value.

Exceptions

resultSelector is null.

Applies to

AggregateAsync<TSource,TAccumulate,TResult>(IAsyncEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, Func<TAccumulate, TResult>, CancellationToken)

Source:
AggregateAsync.cs

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)

Type Parameters

TSource

The type of the elements of source.

TAccumulate

The type of the accumulator value.

TResult

The type of the resulting value.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> to aggregate over.

seed
TAccumulate

The initial accumulator value.

func
Func<TAccumulate,TSource,TAccumulate>

An accumulator function to be invoked on each element.

resultSelector
Func<TAccumulate,TResult>

A function to transform the final accumulator value into the result value.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

The transformed final accumulator value.

Exceptions

resultSelector is null.

Applies to

AggregateAsync<TSource,TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>, CancellationToken)

Source:
AggregateAsync.cs

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)

Type Parameters

TSource

The type of the elements of source.

TAccumulate

The type of the accumulator value.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> to aggregate over.

seed
TAccumulate

The initial accumulator value.

func
Func<TAccumulate,TSource,CancellationToken,ValueTask<TAccumulate>>

An accumulator function to be invoked on each element.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

ValueTask<TAccumulate>

The final accumulator value.

Exceptions

func is null.

Applies to

AggregateAsync<TSource,TAccumulate>(IAsyncEnumerable<TSource>, TAccumulate, Func<TAccumulate,TSource,TAccumulate>, CancellationToken)

Source:
AggregateAsync.cs

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)

Type Parameters

TSource

The type of the elements of source.

TAccumulate

The type of the accumulator value.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> to aggregate over.

seed
TAccumulate

The initial accumulator value.

func
Func<TAccumulate,TSource,TAccumulate>

An accumulator function to be invoked on each element.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

ValueTask<TAccumulate>

The final accumulator value.

Exceptions

func is null.

Applies to

AggregateAsync<TSource>(IAsyncEnumerable<TSource>, Func<TSource,TSource,CancellationToken,ValueTask<TSource>>, CancellationToken)

Source:
AggregateAsync.cs

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)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> to aggregate over.

func
Func<TSource,TSource,CancellationToken,ValueTask<TSource>>

An accumulator function to be invoked on each element.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

ValueTask<TSource>

The final accumulator value.

Exceptions

func is null.

source contains no elements.

Applies to

AggregateAsync<TSource>(IAsyncEnumerable<TSource>, Func<TSource,TSource,TSource>, CancellationToken)

Source:
AggregateAsync.cs

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)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> to aggregate over.

func
Func<TSource,TSource,TSource>

An accumulator function to be invoked on each element.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

ValueTask<TSource>

The final accumulator value.

Exceptions

func is null.

source contains no elements.

Applies to