Intermezzo: Manual Callback Plumbing

It’s quite instructive to think about how the same asynchronous behavior could be achieved without leveraging the new asynchronous method and await expression language features. In this section, we rewrite the last example using manual callback style programming to show how hard it is to map logical control flow on physical, callback-driven execution.

Keep in mind, though, that this kind of manual plumbing is no longer needed thanks to new language features. However, by going through this exercise, it becomes clear how developers were led down the synchronous path before, simply because getting the asynchronous alternative right was deemed too hard and error prone.

The first thing to build a TAP-based method ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.