Export (0) Print
Expand All

CancellationToken.ThrowIfCancellationRequested Method

Throws a OperationCanceledException if this token has had cancellation requested.

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

public void ThrowIfCancellationRequested()

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:
© 2014 Microsoft