Skip to content

,--1,System.Func{--1,--0,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask{--1}})} ,--1,System.Func{--1,--0,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask{--1}},System.Threading.CancellationToken)} ,--1,System.Func{--1,--0,--1})} ,--1,System.Func{--1,--0,--1},System.Threading.CancellationToken)} ,--1,System.Func{--1,--0,--1},System.Func{--1,--2})} ,--1,System.Func{--1,--0,--1},System.Func{--1,--2},System.Threading.CancellationToken)}

ObservableAsync.AggregateAsync(IObservableAsync, TAcc, Func>) method

Defined in

Type: ObservableAsync Namespace: ReactiveUI.Extensions.Async Assembly: ReactiveUI.Extensions.dll

Applies to

net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481

Overloads

  • 1. public static ValueTask<TAcc> AggregateAsync<T, TAcc>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, CancellationToken, ValueTask<TAcc>> accumulator)
  • 2. public static ValueTask<TAcc> AggregateAsync<T, TAcc>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, CancellationToken, ValueTask<TAcc>> accumulator, CancellationToken cancellationToken)
  • 3. public static ValueTask<TAcc> AggregateAsync<T, TAcc>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, TAcc> accumulator)
  • 4. public static ValueTask<TAcc> AggregateAsync<T, TAcc>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, TAcc> accumulator, CancellationToken cancellationToken)
  • 5. public static ValueTask<TResult> AggregateAsync<T, TAcc, TResult>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, TAcc> accumulator, Func<TAcc, TResult> resultSelector)
  • 6. public static ValueTask<TResult> AggregateAsync<T, TAcc, TResult>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, TAcc> accumulator, Func<TAcc, TResult> resultSelector, CancellationToken cancellationToken)

1. Overload

public static ValueTask<TAcc> AggregateAsync<T, TAcc>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, CancellationToken, ValueTask<TAcc>> accumulator)

View source

Summary: Applies an asynchronous accumulator function over the observable sequence, returning the final accumulated value when the sequence completes.

Type parameters

NameDescription
TThe type of elements in the source sequence.
TAccThe type of the accumulated value.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
seedTAccThe initial accumulator value.
accumulatorFunc>An asynchronous accumulator function to invoke on each element. Receives the current accumulated value, the current element, and a cancellation token.

Returns: ValueTask -- A task representing the asynchronous operation, containing the final accumulated value.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if accumulator is null.

2. Overload

public static ValueTask<TAcc> AggregateAsync<T, TAcc>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, CancellationToken, ValueTask<TAcc>> accumulator, CancellationToken cancellationToken)

Summary: Applies an asynchronous accumulator function over the observable sequence, returning the final accumulated value when the sequence completes.

Type parameters

NameDescription
TThe type of elements in the source sequence.
TAccThe type of the accumulated value.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
seedTAccThe initial accumulator value.
accumulatorFunc>An asynchronous accumulator function to invoke on each element. Receives the current accumulated value, the current element, and a cancellation token.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the operation.

Returns: ValueTask -- A task representing the asynchronous operation, containing the final accumulated value.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if accumulator is null.

3. Overload

public static ValueTask<TAcc> AggregateAsync<T, TAcc>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, TAcc> accumulator)

View source

Summary: Applies an accumulator function over the observable sequence, returning the final accumulated value when the sequence completes.

Type parameters

NameDescription
TThe type of elements in the source sequence.
TAccThe type of the accumulated value.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
seedTAccThe initial accumulator value.
accumulatorFuncAn accumulator function to invoke on each element. Receives the current accumulated value and the current element.

Returns: ValueTask -- A task representing the asynchronous operation, containing the final accumulated value.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if accumulator is null.

4. Overload

public static ValueTask<TAcc> AggregateAsync<T, TAcc>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, TAcc> accumulator, CancellationToken cancellationToken)

View source

Summary: Applies an accumulator function over the observable sequence, returning the final accumulated value when the sequence completes.

Type parameters

NameDescription
TThe type of elements in the source sequence.
TAccThe type of the accumulated value.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
seedTAccThe initial accumulator value.
accumulatorFuncAn accumulator function to invoke on each element. Receives the current accumulated value and the current element.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the operation.

Returns: ValueTask -- A task representing the asynchronous operation, containing the final accumulated value.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if accumulator is null.

5. Overload

public static ValueTask<TResult> AggregateAsync<T, TAcc, TResult>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, TAcc> accumulator, Func<TAcc, TResult> resultSelector)

View source

Summary: Applies an accumulator function over the observable sequence with a seed value, then applies a result selector to the final accumulated value.

Type parameters

NameDescription
TThe type of elements in the source sequence.
TAccThe type of the intermediate accumulated value.
TResultThe type of the result value.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
seedTAccThe initial accumulator value.
accumulatorFuncAn accumulator function to invoke on each element.
resultSelectorFuncA function to transform the final accumulated value into the result value.

Returns: ValueTask -- A task representing the asynchronous operation, containing the transformed result.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if accumulator or resultSelector is null.

6. Overload

public static ValueTask<TResult> AggregateAsync<T, TAcc, TResult>(this IObservableAsync<T> @this, TAcc seed, Func<TAcc, T, TAcc> accumulator, Func<TAcc, TResult> resultSelector, CancellationToken cancellationToken)

Summary: Applies an accumulator function over the observable sequence with a seed value, then applies a result selector to the final accumulated value.

Type parameters

NameDescription
TThe type of elements in the source sequence.
TAccThe type of the intermediate accumulated value.
TResultThe type of the result value.

Parameters

NameTypeDescription
this[IObservableAsync](#The source observable sequence.
seedTAccThe initial accumulator value.
accumulatorFuncAn accumulator function to invoke on each element.
resultSelectorFuncA function to transform the final accumulated value into the result value.
cancellationTokenCancellationTokenA cancellation token that can be used to cancel the operation.

Returns: ValueTask -- A task representing the asynchronous operation, containing the transformed result.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if accumulator or resultSelector is null.