Skip to content

,System.Linq.Expressions.Expression{System.Func{--0,--0,--0}})} ,--1,System.Linq.Expressions.Expression{System.Func{--1,--0,--1}})} ,--1,System.Linq.Expressions.Expression{System.Func{--1,--0,--1}},System.Linq.Expressions.Expression{System.Func{--1,--2}})}

Qbservable.Aggregate(IQbservable, Expression>) method

Defined in

Type: Qbservable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static IQbservable<TSource> Aggregate<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
  • 2. public static IQbservable<TAccumulate> Aggregate<TSource, TAccumulate>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
  • 3. public static IQbservable<TResult> Aggregate<TSource, TAccumulate, TResult>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, Expression<Func<TAccumulate, TResult>> resultSelector)

1. Overload

public static IQbservable<TSource> Aggregate<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)

Summary: Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. For aggregation behavior with incremental intermediate results, see Scan.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence and the result of the aggregation.

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to aggregate over.
accumulatorExpression>An accumulator function to be invoked on each element.

Returns: IQbservable -- An observable sequence containing a single element with the final accumulator value.

Remarks

The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or accumulator is null.
System.InvalidOperationException(Asynchronous) The source sequence is empty.

2. Overload

public static IQbservable<TAccumulate> Aggregate<TSource, TAccumulate>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)

Summary: Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value. For aggregation behavior with incremental intermediate results, see Scan.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.
TAccumulateThe type of the result of the aggregation.

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to aggregate over.
seedTAccumulateThe initial accumulator value.
accumulatorExpression>An accumulator function to be invoked on each element.

Returns: IQbservable -- An observable sequence containing a single element with the final accumulator value.

Remarks

The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or accumulator is null.

3. Overload

public static IQbservable<TResult> Aggregate<TSource, TAccumulate, TResult>(this IQbservable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, Expression<Func<TAccumulate, TResult>> resultSelector)

Summary: Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value, and the specified result selector function is used to select the result value.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.
TAccumulateThe type of the accumulator value.
TResultThe type of the resulting value.

Parameters

NameTypeDescription
source[IQbservable](#An observable sequence to aggregate over.
seedTAccumulateThe initial accumulator value.
accumulatorExpression>An accumulator function to be invoked on each element.
resultSelectorExpression>A function to transform the final accumulator value into the result value.

Returns: IQbservable -- An observable sequence containing a single element with the final accumulator value.

Remarks

The return type of this operator differs from the corresponding operator on IEnumerable in order to retain asynchronous behavior.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or accumulator or resultSelector is null.