controlflow
controlflow

Reputation: 6737

IObservable<T> in .NET Framework 4.0 Beta2

IObservable<T> and IObserver<T> interfaces are placed directly in the System namespace in .NET Framework 4.0 Beta2. Why not in System.Collections.Generic, like IEnumerable<T>?

p.s. Reactive Framework preview from Silverlight Toolkit contains IObserver<T> in the System.Collections.Generic namespace.

Upvotes: 2

Views: 1167

Answers (3)

Andre White
Andre White

Reputation: 86

Although this is an old question I stumbled upon, I just wanted to back @ControlFlow's assessment of the 'dualism' between IObservable and IEnumerable as a 'Pushed based' vs 'Pull based' collection with a link to Erik Meijer's 'Rx in 15 Minutes', where he can be quoted as saying exactly that. http://channel9.msdn.com/posts/Charles/Erik-Meijer-Rx-in-15-Minutes/

Consequently, this pushed-based collection can fundamentally shift the basic paradigm of 'a mundane series of called events' into an asynchronous, selectable, query-able, passable and subscribe-able first-class collection of declarative actionable. Something that does that belongs in the core BCL namespace or perhaps deserves it's own, but is too far beyond Yet-Another-Collection to share its namespace. Mind you, that's just my opinion.

Upvotes: 1

UserControl
UserControl

Reputation: 15159

The thing that new IObservable/IObserver interfaces describe is an abstraction much higher than just collections which can be seen as a special case of computations (that's why lists in Haskell are monads). So it's obvious that such generalization is placed to System namespace.

Take a look at this brilliant cast from Erik Meijer where he describes the ideas behind the interfaces.

Upvotes: 2

Andrew Keith
Andrew Keith

Reputation: 7563

IObservable is an interface that identifies a class that implements the Observer pattern. Its not related to Collections. Its more related to providing an alternative to Events.

Upvotes: 4

Related Questions