Rx framework — IObservable<T>.CombineLatest

The IObservable<T>.CombineLatest exten­sion method is very sim­i­lar to IObservable<T>.Zip and IObservable<T>.Merge in that it com­bines two observ­able col­lec­tions and returns a new one.

Unlike IObservable<T>.Merge, IObservable<T>.CombineLatest does not require the merged observ­able col­lec­tions to be of the same type.

Like IObservable<T>.Zip, IObservable<T>.CombineLatest com­bines ‘pairs’ of val­ues from the two observ­able col­lec­tions, but unlike Zip when a new val­ue becomes avail­able on one col­lec­tion it does not wait till a new val­ue to be avail­able on the oth­er col­lec­tion, instead it takes what­ev­er the lat­est val­ue is from the oth­er col­lec­tion (pro­vid­ed there is one):

image

Again, like the Merge method, you can either invoke Com­bineLat­est as an exten­sion method:

var zs = xs.CombineLatest(ys, (a, b) => a + b);

or you can invoke it as sta­t­ic method:

var zs = Observable.CombineLatest(xs, ys, (a, b) => a + b);