You are on page 1of 1

Async Sample: Fine Tuning Your Application (C# and Visual Basic)

Technologies
Async
Topics
Asynchronous Programming, Async
Platforms
Desktop
Requirements
Primary language
en-US
Updated
2/26/2013
License
MS-LPL

View this sample online

Introduction
You can add precision and flexibility to your async applications by using the methods and properties that the
Task type makes available. The projects in this sample use CancellationToken and important Task methods such
as Task.WhenAll and Task.WhenAny.
Building the Sample

1. Unzip the downloaded file.


2. Open Visual Studio 2012 or Visual Studio Express 2012 for Windows Desktop.
3. On the menu bar, choose File, Open, Project/Solution.
4. Navigate to the directory that holds the unzipped sample.
5. Open the solution (.sln) file.
6. In Solution Explorer, open the shortcut menu for the project you want to run and then choose Set as
StartUp Project.
7. Choose F5 or Ctrl+F5 to build and run the sample.

Description
The examples in this sample show you how to do the following:

 Cancel a Task (project CancelATask)


 Cancel a list of Tasks (project CancelAListOfTasks)
 Cancel Tasks after a period of time(project CancelAfterTime)
 Cancel remaining Tasks after one is complete (project CancelAfterOneTask)
 Start multiple tasks and process them as they complete (project ProcessTasksAsTheyFinish)

More Information
For more information about these projects, see Fine Tuning Your Async Application. For more information
about using async and await, see Asynchronous Programming with Async and Await and the topics that are
described there.

You might also like