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 Rx apart from events in .NET. Also, it is important to note that including the System.Reactive.Linq namespace in your project allows developers to write queries over the Subject type because a Subject is an IObservable interface:

This is another feature that sets Rx apart from the events in .NET.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.137.7