Asynchronous programming using the upcoming await C# 4.5 keyword

One of the features in the Base Class Library of the upcoming 4.5 .Net Framework is a new way to do asynchronous programming. While reading the “Walkthrough: Accessing the Web by Using Async and Await” I started to wonder: How are these method calls updating the UI (by appending to the textbox) from a non-UI thread?

The short answer? They’re not! Asynchronous methods (the ones you await) don’t run on their own thread. For a developer coming from a Windows Forms background (land of the Holy BackgroundWorker) I assumed that the whole await business was a new way of doing multithreading.

Apparently it’s not. It’s a new way of doing asynchronous programming. Until now I considered the two synonymous. await makes it clear that they’re not.

No comments:

Post a Comment