Introduction
This sample contains the example code from
async (C# Reference). The example just shows you how to declare and call async methods in C#.
Building the Sample
- Unzip the downloaded file.
- Open Visual Studio 2012, Visual Studio Express 2012 for Windows Desktop, or Visual Studio 2012 for Windows 8.
- On the menu bar, choose File, Open, Project/Solution.
- Navigate to the directory that holds the unzipped sample.
- Open the solution (.sln) file.
- In Solution Explorer, open the shortcut menu for the version of the project that you want to run, and then choose Set as StartUp Project.
- asyncKeywordCS-Store is set up to run on Windows 8 by using Visual Studio 2012 or Visual Studio 2012 Express for Windows 8.
- asyncKeywordCS-WPF is set up to run as a desktop (WPF) app by using Visual Studio 2012 or Visual Studio 2012 Express for Desktop.
- Choose F5 or Ctrl+F5 to build and run the sample.
Description
Visual Studio 2012 introduces a simplified approach to asynchronous programming that leverages asynchronous support in the .NET Framework 4.5 and the Windows Runtime. The compiler does the difficult work that the developer used to do, and your application
retains a logical structure that resembles synchronous code. As a result, you get all the advantages of asynchronous programming with a fraction of the effort.
This sample shows you how to use the async keyword to mark a method as an async method.
More Information
For more information on async programming, see
Asynchronous Programming with Async and Await (C# and Visual Basic).