CancellationToken::ThrowIfCancellationRequested Method

Throws a OperationCanceledException if this token has had cancellation requested.

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

No code example is currently available or this language may not be supported.

ExceptionCondition
OperationCanceledException

The token has had cancellation requested.

ObjectDisposedException

The associated CancellationTokenSource has been disposed.

This method provides functionality equivalent to:

C#

    if (token.IsCancellationRequested) 
        throw new OperationCanceledException(token);
    If token.IsCancellationRequested Then
        Throw New OperationCanceledException(token)
    End If

Silverlight

Supported in: 5

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

Community Additions

ADD
Show: