What's New for Visual C# in Visual Studio 11 Beta

Switch View :
ScriptFree
Visual Studio 2010 - Visual C#
What's New for Visual C# in Visual Studio 11 Beta

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

This page lists the new and enhanced features available in Visual C# in Visual Studio 11 Beta.

For information about new integrated development environment (IDE) features for creating Windows 8 Consumer Preview applications, see Tour of the IDE for C#/C++/Visual Basic Developers.

Async Feature

The Async feature provides an easy and intuitive way to write asynchronous code. This feature 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 asynchronous operations finish. This complicates your code, and makes routine tasks, such as exception handling, awkward and difficult. By using the Async feature, you can call asynchronous methods without writing continuations, and without splitting your code across multiple methods or lambda expressions. The compiler does the hard work for you.

The feature introduces two new keywords, async and await. The async modifier specifies that a method is an async method. When called, an async method returns a Task or Task<TResult>, which 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 and its unique ID.

Typically, the await operator is applied to the returned task. The await operator suspends execution of the method that called the asynchronous method until the task is completed. In the meantime, control is returned to the caller of the suspended method.

For more information, see Asynchronous Programming with Async and Await (C# and Visual Basic).

Caller Information

In this release, you can more easily 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, debugging, and creating diagnostic tools.

For more information, see Caller Information (C# and Visual Basic).

See Also

Reference

Concepts