About This eBook by Bart De Smet

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Pull Versus Push

The IObservable<T> and IObserver<T> interfaces might look a little weird at first, but they are actually very closely related to the well-known System.Collections.Generic interfaces IEnumerable<T> and IEnumerator<T>. In fact, they are mathematical duals. It’s normal you perceive this as rather abstract, but it’s rather simple. Follow me.

From our discussion about statements, recall that IEnumerable<T>’s primary use is the foreach loop statement. Collections implement this interface, allowing us to retrieve their data by pulling it out one by one. In fact, the consumer is in control, which makes this an interactive mechanism. To pull data from the source, the consumer asks the enumerator for more data by calling MoveNext and ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required