What’s In This Chapter?
Wrox.com Code Downloads for This Chapter
The wrox.com code downloads for this chapter are found at www.wrox.com/go/professionalcsharp6 on the Download Code tab. The code for this chapter is divided into the following major examples:
C# 6 adds a lot of new keywords, whereas with C# 5 there were only two new keywords: async and await. These two keywords are the main focus of this chapter.
With asynchronous programming a method is called that runs in the background (typically with the help of a thread or task), and the calling thread is not blocked.
In this chapter, you can read about different patterns on asynchronous programming such as the asynchronous pattern, the event-based asynchronous pattern, and the task-based asynchronous pattern (TAP). TAP makes use of the async and await keywords. Comparing these patterns you can see the real advantage of the new style of asynchronous programming.
After discussing the different patterns, you see the foundation of asynchronous programming by creating tasks and invoking asynchronous methods. You find out what’s behind the scenes with continuation tasks and the synchronization context. ...