Condividi tramite


CancellationTokenSource.CreateLinkedTokenSource Method (array<CancellationToken[])

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared Function CreateLinkedTokenSource ( _
    ParamArray tokens As CancellationToken() _
) As CancellationTokenSource
public static CancellationTokenSource CreateLinkedTokenSource(
    params CancellationToken[] tokens
)

Parameters

Return Value

Type: System.Threading.CancellationTokenSource
A CancellationTokenSource that is linked to the source tokens.

Exceptions

Exception Condition
ObjectDisposedException

A CancellationTokenSource associated with one of the source tokens has been disposed.

ArgumentNullException

tokens is null.

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.

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.