Rx framework – IObservable<T>.CombineLatest

Yan Cui

I help clients go faster for less using serverless technologies.

This article is brought to you by

Don’t reinvent the patterns. Catalyst gives you consistent APIs for messaging, data, and workflow with key microservice patterns like circuit-breakers and retries for free.

Try the Catalyst beta

The IObservable<T>.CombineLatest extension method is very similar to IObservable<T>.Zip and IObservable<T>.Merge in that it combines two observable collections and returns a new one.

Unlike IObservable<T>.Merge, IObservable<T>.CombineLatest does not require the merged observable collections to be of the same type.

Like IObservable<T>.Zip, IObservable<T>.CombineLatest combines ‘pairs‘ of values from the two observable collections, but unlike Zip when a new value becomes available on one collection it does not wait till a new value to be available on the other collection, instead it takes whatever the latest value is from the other collection (provided there is one):

image

Again, like the Merge method, you can either invoke CombineLatest as an extension method:

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

or you can invoke it as static method:

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

Whenever you’re ready, here are 3 ways I can help you:

  1. Production-Ready Serverless: Join 20+ AWS Heroes & Community Builders and 1000+ other students in levelling up your serverless game. This is your one-stop shop for quickly levelling up your serverless skills.
  2. I help clients launch product ideas, improve their development processes and upskill their teams. If you’d like to work together, then let’s get in touch.
  3. Join my community on Discord, ask questions, and join the discussion on all things AWS and Serverless.

2 thoughts on “Rx framework – IObservable<T>.CombineLatest”

  1. Pingback: StatArb: Rx CombineLatest and JoinBlock (Visual Studio Async CTP) – Part 3 « Tales from a Trading Desk

  2. Pingback: StatArb: Rx CombineLatest and JoinBlock (Visual Studio Async CTP) – Part 3 » Lab49 Blog

Leave a Comment

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