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);

 

Learn to build Production-Ready Serverless applications

Want to learn how to build Serverless applications and follow best practices? Subscribe to my newsletter and join over 5,000 AWS & Serverless enthusiasts who have signed up already.

Leave a Comment

Your email address will not be published. Required fields are marked *