IObservable and IObserver

As noted in the introduction, the key to Rx is the relationship between an observable collection and the objects that subscribe to that collection. The key interfaces for Rx, comparable to IEnumerable and IEnumerator are IObservable and IObserver.

IObservable is defined as follows:

__________

1 Wikipedia, “Design Patterns,” http://en.wikipedia.org/wiki/Design_Patterns.

public interface IObservable<out T> {         IDisposable Subscribe (IObserver<T> observer); }

IObserver looks like this:

public interface IObserver<in T> {         void OnCompleted();         void OnError(Exception error);         void OnNext(T value); }

In order to receive notifications from an observable collection, use the Subscribe method and ...

Get Programming Reactive Extensions and LINQ 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.