| [Export] Bnaya Eshet |
Rx - Aggregate vs. Scan this post will focus on 2 Rx operators Aggregate and Scan. both Aggregate and Scan are dealing with event stream accumulation, the only difference is that Aggregate produce single result (upon the stream completion)
and Scan present an ongoing runtime accumulation which react for each OnNext. both operators has 2 overloads with the same signature: the first overload (line 1,5) gets a simple accumulation Func which get the previous accumulated value and the current value as parameters and should return new accumulated value (on the first accumulation the previous accumulated value will be default(T)). the second overload define a seed value for the first accumulation and a Func which get the previous accumulated value and the current value as parameters...(Read whole news on source site)
and Scan present an ongoing runtime accumulation which react for each OnNext. both operators has 2 overloads with the same signature:
Code Snippet
IObservable Aggregate( this IObservable source, Func accumulator); IObservable Scan( this IObservable source, Func accumulator);
IObservable Aggregate( this IObservable source, TAccumulate seed, Func accumulator); IObservable Scan( this IObservable source, TAccumulate seed, Func accumulator);




