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

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 ...

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