How it works...

In Rx, we can declare an event stream with the Subject keyword. So, we have a source of events that we can publish to using OnNext. To see those values in the console window, we subscribed to the event stream using Subscribe.

Rx allows you to have objects that are just publishers or just subscribers. This is because the IObservable and IObserver interfaces are in fact separate. Also, note that in Rx, the observables can be passed as parameters, returned as results, and stored in variables, which makes them first class.

Rx also allows you to specify that the event stream is completed or that an error occurred. This really sets ...

Get C# 7 and .NET Core Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.