New Asynchronous Features Enhance .NET Framework 4.5

| by Jenni Konrad Follow 0 Followers on Apr 11, 2012. Estimated reading time: 1 minute |

Developers who have had the opportunity to try out Visual Studio 11 or the Visual Studio Async CTP may be familiar with the new keywords Await and Async in Visual Basic and C#. Recently, Microsoft detailed some of the new changes in .NET Framework 4.5 that will further extend asynchronous programming capabilities.

Writing asynchronous code has become significantly easier in .NET 4.5, and will no longer require very complex methods or callbacks. The structure of new async tasks will look quite familiar to developers; here’s an example of a synchronous method declaration and its asynchronous counterpart:

'synchronous method
Private Function GetInfo(url As String) As Byte()

'asynchronous method
Private Async Function GetInfo(url As String) As Task(Of Byte())

Asynchronous methods return a task; when Await is called against that task, the method is immediately suspended, and resumes once the task is complete. The structure is simple, but implementing asynchronous code requires a great deal more consideration to avoid decreasing performance.

In addition to the C# and Visual Basic language changes, .NET Framework 4.5 Developer Preview adds a collection of asynchronous methods for common operations. System.IO now includes methods such as ReadAsync, WriteAsync, CopyToAsync, and a few others. Many of the methods in System.Data.Common and System.Data.SqlClient have accompanying asynchronous versions, such as ExecuteQueryAsync, ExecuteScalarAsync, and ReadAsync.

ASP.NET 4.5 allows developers to use HttpRequest.GetBufferlessInputStream asynchronously, and introduces the HttpTaskAsyncHandler to make it easier to write asynchronous handlers and utilize tasks. Windows Communication Foundation (WCF) and Windows Presentation Foundation (WPF) include new asynchronous features as well.

To get started with the new asynchronous features in .NET Framework 4.5 Beta, visit Visual Studio Asynchronous Programming. The framework is available as part of Visual Studio 11, or via the Async CTP for Visual Studio 2010.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you