CancellationToken.ThrowIfCancellationRequested Método

Definição

Lança um OperationCanceledException caso este token tenha sido pedido de cancelamento.

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

Exceções

O token foi solicitado a cancelar.

Observações

Este método fornece funcionalidades equivalentes a:

C#

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

Aplica-se a

Ver também