Rx framework – IObservable<T>.Concat

Yet another extension method to combine two observable collections, this time we have IObservable<T>.Concat which is very similar to IObservable<T>.Merge, but crucially, when you concatenate one observable collection to another, the subscription to the second observable collection happens after the first had completed! Here’s a quick illustration of how the two methods differ:

image

As you’ve probably guessed already, the Concat method requires the observable collections to be merged to be of the same type.

Again, you can either invoke it as an extension method:

var zs = xs.Concat(ys);

or you can invoke it as static method on more than two observable collections:

var zs = Observable.Concat(xs, ys, us, vs);