O'Reilly logo

Programming Reactive Extensions and LINQ by Paul Betts, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Join Patterns

Let's take a look at Join pattern operators, which act like Zip on steroids (for a reminder of Zip, see Chapter 5). The Join pattern allows you to combine streams using And and Or, which lets you match many, more complicated patterns. The typical pattern is “Tell me when either of (A && B && C or D && E) happens. To make this work you'll need to use three main methods, When, And and Then.

  • When(): At the very end says “Tell me when any of the patterns happen”
  • And(): Creates a Join pattern by saying “Wait until A and B produce an item. These can be concatenated, allowing you to wait for A and B and C.
  • Then(): Once you finish combining using and, then works like select, it allows you to combine the results into a value.

The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required