Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 3.23 KB

File metadata and controls

49 lines (34 loc) · 3.23 KB
title Fine-Tuning Your Async Application (C#)
ms.custom
ms.date 07/20/2015
ms.prod .net
ms.reviewer
ms.suite
ms.technology
devlang-csharp
ms.topic article
ms.assetid 97696eb9-81fc-4940-9655-84daa8eb4d5c
caps.latest.revision 3
author BillWagner
ms.author wiwagn

Fine-Tuning Your Async Application (C#)

You can add precision and flexibility to your async applications by using the methods and properties that the xref:System.Threading.Tasks.Task type makes available. The topics in this section show examples that use xref:System.Threading.CancellationToken and important Task methods such as xref:System.Threading.Tasks.Task.WhenAll%2A?displayProperty=nameWithType and xref:System.Threading.Tasks.Task.WhenAny%2A?displayProperty=nameWithType.

By using WhenAny and WhenAll, you can more easily start multiple tasks and await their completion by monitoring a single task.

This section includes the following examples.

Note

To run the examples, you must have Visual Studio 2012 or newer and the .NET Framework 4.5 or newer installed on your computer.

The projects create a UI that contains a button that starts the process and a button that cancels it, as the following image shows. The buttons are named startButton and cancelButton.

WPF window with Cancel button

You can download the complete Windows Presentation Foundation (WPF) projects from Async Sample: Fine Tuning Your Application.

See Also

Asynchronous Programming with async and await (C#)