Chapter 2. Reactive Programming with C#

In the previous chapter, we gave an overall introduction to reactive programming and related languages and frameworks.

In this chapter, we will see a practical example of reactive programming with pure C# coding.

The following topics will be discussed here:

  • IObserver interface
  • IObservable interface
  • Subscription life cycle
  • Sourcing events
  • Filtering events
  • Correlating events
  • Sourcing from CLR streams
  • Sourcing from CLR enumerables

IObserver interface

This core level interface is available within the Base Class Library (BCL) of .NET 4.0 and is available for the older 3.5 as an add-on.

The use is pretty simple and the goal is to provide a standard way of handling the most basic features of any reactive message consumer.

Get Reactive Programming for .NET Developers 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.