Skip to content

,--1,System.Func{--1,--0,--1})} ,System.Func{--0,--0,--0})}

Observable.Scan(IObservable, TAccumulate, Func) method

Defined in

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

Applies to

netstandard2.0

Overloads

  • 1. public static IObservable<TAccumulate> Scan<TSource, TAccumulate>(this IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)
  • 2. public static IObservable<TSource> Scan<TSource>(this IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)

1. Overload

public static IObservable<TAccumulate> Scan<TSource, TAccumulate>(this IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> accumulator)

Summary: Applies an accumulator function over an observable sequence and returns each intermediate result. The specified seed value is used as the initial accumulator value. For aggregation behavior with no intermediate results, see Aggregate.

Type parameters

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

Parameters

NameTypeDescription
sourceIObservableAn observable sequence to accumulate over.
seedTAccumulateThe initial accumulator value.
accumulatorFuncAn accumulator function to be invoked on each element.

Returns: IObservable -- An observable sequence containing the accumulated values.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or accumulator is null.

2. Overload

public static IObservable<TSource> Scan<TSource>(this IObservable<TSource> source, Func<TSource, TSource, TSource> accumulator)

Summary: Applies an accumulator function over an observable sequence and returns each intermediate result. For aggregation behavior with no intermediate results, see Aggregate.

Type parameters

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

Parameters

NameTypeDescription
sourceIObservableAn observable sequence to accumulate over.
accumulatorFuncAn accumulator function to be invoked on each element.

Returns: IObservable -- An observable sequence containing the accumulated values.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or accumulator is null.