CancellationToken.ThrowIfCancellationRequested Metod

Definition

Genererar ett OperationCanceledException om den här token har begärt annullering.

public:
 void ThrowIfCancellationRequested();
public void ThrowIfCancellationRequested();
member this.ThrowIfCancellationRequested : unit -> unit
Public Sub ThrowIfCancellationRequested ()

Undantag

Token har begärt annullering.

Kommentarer

Den här metoden tillhandahåller funktioner som motsvarar:

C#

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

Gäller för

Se även