I wonder why .NET framework doesn't have pair (Observer/Observable) interfaces similar to Java's feature?
EDIT: yes i know about events and delegates but using those interfaces is a simple and bookish approach of this DP isn't it?
In .NET 4 it does: System.IObservable<T>
and System.IObserver<T>
(which are a Dual of IEnumerable<T>
and IEnumerator<T>
). Look at the Reactive Extensions (Rx) project for compositional use of these interfaces with asynchronous events.
More generally, the Observer pattern is better served in .NET with events.