Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

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.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.