If you’re writing one of several applications that call for asynchronous programming, this concise hands-on guide shows you how the async feature in C# 5.0 can make the process much simpler. Along with a clear introduction to asynchronous programming, you get an in-depth look at how the async feature works and why you might want to use it in your application.

Written for experienced C# programmers—yet approachable for beginners—this book is ...

See more details below
Async in C# 5.0

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 15%)$9.99 List Price


If you’re writing one of several applications that call for asynchronous programming, this concise hands-on guide shows you how the async feature in C# 5.0 can make the process much simpler. Along with a clear introduction to asynchronous programming, you get an in-depth look at how the async feature works and why you might want to use it in your application.

Written for experienced C# programmers—yet approachable for beginners—this book is packed with code examples that you can extend for your own projects.

  • Write your own asynchronous code, and learn how async saves you from this messy chore
  • Discover new performance possibilities in ASP.NET web server code
  • Explore how async and WinRT work together in Windows 8 applications
  • Learn the importance of the await keyword in async methods
  • Understand which .NET thread is running your code—and at what points in the program
  • Use the Task-based Asynchronous Pattern (TAP) to write asynchronous APIs in .NET
  • Take advantage of parallel computing in modern machines
  • Measure async code performance by comparing it with alternatives
Read More Show Less

Product Details

  • ISBN-13: 9781449337124
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 9/7/2012
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 108
  • Sales rank: 1,163,080
  • File size: 4 MB

Meet the Author

Alex is a coder, blogger and concurrency enthusiast from England. He currently works as a developer and product owner at Red Gate, working on tools for .NET developers. Before that, he did a degree in computer science at Cambridge University, and still has theoretical CS in his blood. In his spare time he writes an open source Actors framework for .NET, to let people write parallel programs more easily.

Read More Show Less

Table of Contents

Intended Audience;
How to Read This Book;
Conventions Used in This Book;
Using Code Examples;
Safari® Books Online;
How to Contact Us;
Chapter 1: Introduction;
1.1 Asynchronous Programming;
1.2 What’s So Great About Asynchronous Code?;
1.3 What Is Async?;
1.4 What Async Does;
1.5 Async Doesn’t Solve Everything;
Chapter 2: Why Programs Need to Be Asynchronous;
2.1 Desktop User Interface Applications;
2.2 Web Application Server Code;
2.3 Silverlight, Windows Phone, and Windows 8;
2.4 Parallel Code;
2.5 An Example;
Chapter 3: Writing Asynchronous Code Manually;
3.1 Some Asynchronous Patterns Used in .NET;
3.2 The Simplest Asynchronous Pattern;
3.3 An Introduction to Task;
3.4 The Problem with Manual Asynchrony;
3.5 Converting the Example to Use Manual Asynchronous Code;
Chapter 4: Writing Async Methods;
4.1 Converting the Favicon Example to Async;
4.2 Task and await;
4.3 Async Method Return Types;
4.4 Async, Method Signatures, and Interfaces;
4.5 The return Statement in Async Methods;
4.6 Async Methods Are Contagious;
4.7 Async Anonymous Delegates and Lambdas;
Chapter 5: What await Actually Does;
5.1 Hibernating and Resuming a Method;
5.2 The State of the Method;
5.3 Context;
5.4 Where await Can’t Be Used;
5.5 Exception Capture;
5.6 Async Methods Are Synchronous Until Needed;
Chapter 6: The Task-Based Asynchronous Pattern;
6.1 What the TAP Specifies;
6.2 Using Task for Compute-Intensive Operations;
6.3 Creating a Puppet Task;
6.4 Interacting with Old Asynchronous Patterns;
6.5 Cold and Hot Tasks;
6.6 Up-Front Work;
Chapter 7: Utilities for Async Code;
7.1 Delaying for a Period of Time;
7.2 Waiting for a Collection of Tasks;
7.3 Waiting for Any One Task from a Collection;
7.4 Creating Your Own Combinators;
7.5 Cancelling Asynchronous Operations;
7.6 Returning Progress During an Asynchronous Operation;
Chapter 8: Which Thread Runs My Code?;
8.1 Before the First await;
8.2 During the Asynchronous Operation;
8.3 SynchronizationContext in Detail;
8.4 await and SynchronizationContext;
8.5 The Lifecycle of an Async Operation;
8.6 Choosing Not to Use SynchronizationContext;
8.7 Interacting with Synchronous Code;
Chapter 9: Exceptions in Async Code;
9.1 Exceptions in Async Task-Returning Methods;
9.2 Unobserved Exceptions;
9.3 Exceptions in Async void Methods;
9.4 Fire and Forget;
9.5 AggregateException and WhenAll;
9.6 Throwing Exceptions Synchronously;
9.7 finally in Async Methods;
Chapter 10: Parallelism Using Async;
10.1 await and locks;
10.2 Actors;
10.3 Using Actors in C#;
10.4 Task Parallel Library Dataflow;
Chapter 11: Unit Testing Async Code;
11.1 The Problem with Unit Testing in Async;
11.2 Writing Working Async Tests Manually;
11.3 Using Unit Test Framework Support;
Chapter 12: Async in ASP.NET Applications;
12.1 Advantages of Asynchronous Web Server Code;
12.2 Using Async in ASP.NET MVC 4;
12.3 Using Async in Older Versions of ASP.NET MVC;
12.4 Using Async in ASP.NET Web Forms;
Chapter 13: Async in WinRT Applications;
13.1 What Is WinRT?;
13.2 IAsyncAction and IAsyncOperation<T>;
13.3 Cancellation;
13.4 Progress;
13.5 Providing Asynchronous Methods in a WinRT Component;
Chapter 14: The Async Compiler Transform—in Depth;
14.1 The stub Method;
14.2 The State Machine Struct;
14.3 The MoveNext Method;
14.4 Writing Custom Awaitable Types;
14.5 Interacting with the Debugger;
Chapter 15: The Performance of Async Code;
15.1 Measuring Async Overhead;
15.2 Async Versus Blocking for a Long-Running Operation;
15.3 Optimizing Async Code for a Long-Running Operation;
15.4 Async Versus Manual Asynchronous Code;
15.5 Async Versus Blocking Without a Long-Running Operation;
15.6 Optimizing Async Code Without a Long-Running Operation;
15.7 Async Performance Summary;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)