CancellationTokenSource.CreateLinkedTokenSource Method (CancellationToken, CancellationToken)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Shared Function CreateLinkedTokenSource ( _ token1 As CancellationToken, _ token2 As CancellationToken _ ) As CancellationTokenSource
Parameters
- token1
- Type: System.Threading.CancellationToken
The first CancellationToken to observe.
- token2
- Type: System.Threading.CancellationToken
The second CancellationToken to observe.
Return Value
Type: System.Threading.CancellationTokenSourceA CancellationTokenSource that is linked to the source tokens.
| Exception | Condition |
|---|---|
| ObjectDisposedException | A CancellationTokenSource associated with one of the source tokens has been disposed. |
| ArgumentException | If any of the tokens cannot be canceled, they will not be linked. The returned source will be cancelable. -or- If any of the tokens are already canceled then the linked token will be returned in canceled state. |