You can write asynchronous code more easily and intuitively by using the Async feature, which makes asynchronous programming almost as straightforward as synchronous programming.

Previously, writing asynchronous code has required you to define callbacks (also referred to as continuations) to capture what occurs after an asynchronous process finishes. This complicates your code and makes routine tasks, such as exception handling, awkward and difficult. If you use the Async feature, the compiler does most of the work for you.

The feature introduces two keywords, async and await. The async modifier specifies that a method is an async method. An async method returns a Task or Task<TResult> that represents the ongoing work of the method. The task contains information that the caller of the asynchronous method can use, such as the status of the task, its unique ID, and the method's result.

Typically, an await operator is applied to the returned task in an await expression. The await expression suspends execution of the method that contains it until the awaited task is complete. In the meantime, control is returned to the caller of the suspended method.

This version of Visual C# makes it easier to obtain information about the caller of a method. By using Caller Info attributes, you can identify the file path of the source code, the line number in the source code, and the member name of the caller. This information is helpful for tracing, for debugging, and for creating diagnostic tools.

You can use Visual Studio to download and install samples of packaged C# applications from the MSDN Code Gallery.

You can download the samples individually, or you can download a Sample Pack, which contains related samples that share a technology or topic. You'll receive a notification if source code changes are published for any sample that you downloaded.