Permalink
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (25 sloc) 1.17 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
How to: Wrap EAP Patterns in a Task
03/30/2017
.net
dotnet-standard
article
tasks, how to wrap EAP patterns
f11ed467-af2f-4504-8a2e-299a6c36d44e
9
rpetrusha
ronpet
wpickett

How to: Wrap EAP Patterns in a Task

The following example shows how to expose an arbitrary sequence of Event-Based Asynchronous Pattern (EAP) operations as one task by using a xref:System.Threading.Tasks.TaskCompletionSource%601. The example also shows how to use a xref:System.Threading.CancellationToken to invoke the built-in cancellation methods on the xref:System.Net.WebClient objects.

Example

[!code-csharpFromAsync#08] [!code-vbFromAsync#08]

See Also

TPL and Traditional .NET Framework Asynchronous Programming