What's New for Visual C# in Visual Studio 2012
This page lists the new and enhanced features provided for Visual C# in Visual Studio 2012.
For information about how to create Windows Store apps by using Visual Studio 2012, see Develop Windows Store apps using Visual Studio 2012.
Async and Await
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.
For more information, see Asynchronous Programming with Async and Await (C# and Visual Basic).
Caller Information
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.
For more information, see Caller Information (C# and Visual Basic).
Online Samples
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.
For more information, see Accessing Online Samples.
See Also
Reference
What's New for Application Lifecycle Management Testing in Visual Studio 2012
Concepts
What's New in Visual Studio 2012
What's New in the .NET Framework 4.5
ASP.NET 4.5 and Visual Studio 2012
What's New for Data Application Development in Visual Studio 2012