Observer

Reactive variant with IObservable<T>/Rx.NET.

#When to use it

When you need to compose asynchronous streams (filter, map, throttle, retry) over events.

using System.Reactive.Linq;

IObservable<decimal> prices = /* feed */;
prices
    .Where(p => p > 100)
    .Throttle(TimeSpan.FromSeconds(1))
    .Subscribe(p => Console.WriteLine(
quot;High: {p}"));
Tradeoffs
Pro Con
Powerful declarative composition Steep learning curve
Native handling of back-pressure and cancellation Complex stack traces

#behavioral #rx #reactive