Task Constructor (Action, CancellationToken)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Initializes a new Task with the specified action and CancellationToken.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- action
- Type: System.Action
The delegate that represents the code to execute in the Task.
- cancellationToken
- Type: System.Threading.CancellationToken
The CancellationToken that the new Task will observe.
| Exception | Condition |
|---|---|
| ObjectDisposedException | The provided CancellationToken has already been disposed. |
| ArgumentNullException | The action argument is null. |
For more information, see [458b5e69-5210-45e5-bc44-3888f86abd6f] and [eea11fe5-d8b0-4314-bb5d-8a58166fb1c3].
Show: