CreateLinkedTokenSource Method (CancellationToken, CancellationToken)

Task Parallel System.Threading

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:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function CreateLinkedTokenSource ( _
	token1 As CancellationToken, _
	token2 As CancellationToken _
) As CancellationTokenSource
C#
public static CancellationTokenSource CreateLinkedTokenSource(
	CancellationToken token1,
	CancellationToken token2
)

Parameters

token1
Type: System.Threading..::.CancellationToken
The first CancellationToken to observe.
token2
Type: System.Threading..::.CancellationToken
The second CancellationToken to observe.

Return Value

A CancellationTokenSource that is linked to the source tokens.

Exceptions

ExceptionCondition
System..::.ObjectDisposedExceptionA CancellationTokenSource associated with one of the source tokens has been disposed.

See Also