CancellationToken.ThrowIfCancellationRequested Metoda

Definicja

Zgłasza OperationCanceledException, jeśli ten token ma żądanie anulowania.Throws a OperationCanceledException if this token has had cancellation requested.

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

Wyjątki

Token ma żądanie anulowania.The token has had cancellation requested.

Skojarzona CancellationTokenSource została usunięta.The associated CancellationTokenSource has been disposed.

Uwagi

Ta metoda zapewnia funkcje równoważne:This method provides functionality equivalent to:

Język C#C#

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

Dotyczy

Zobacz też