Skip to Content
Professional C# 5.0 and .NET 4.5.1
book

Professional C# 5.0 and .NET 4.5.1

by Christian Nagel, Jay Glynn, Morgan Skinner
February 2014
Intermediate to advanced
1560 pages
50h 21m
English
Wrox
Content preview from Professional C# 5.0 and .NET 4.5.1

Chapter 13Asynchronous Programming

WHAT’S IN THIS CHAPTER?

  • Why asynchronous programming is important
  • Asynchronous patterns
  • Foundations of the async and await keywords
  • Creating and using asynchronous methods
  • Error handling with asynchronous methods

WROX.COM CODE DOWNLOADS FOR THIS CHAPTER

The wrox.com code downloads for this chapter are found at www.wrox.com/go/procsharp on the Download Code tab. The code for this chapter is divided into the following major examples:

  • Async Patterns
  • Foundations
  • Error Handling

WHY ASYNCHRONOUS PROGRAMMING IS IMPORTANT

The most important change of C# 5 is the advances provided with asynchronous programming. C# 5 adds 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 new 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 will see the foundation of asynchronous programming by creating tasks and invoking asynchronous methods. You’ll learn about what’s behind the scenes with continuation tasks and the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Pro C# 2010 and the .NET 4 Platform, Fifth Edition

Pro C# 2010 and the .NET 4 Platform, Fifth Edition

Andrew Troelsen
ASP.NET 2.0 Illustrated

ASP.NET 2.0 Illustrated

Alex Homer, Dave Sussman
Professional Visual Studio® 2008

Professional Visual Studio® 2008

Nick Randolph, David Gardner

Publisher Resources

ISBN: 9781118832981Purchase book