CancellationToken.ThrowIfCancellationRequested Método

Definição

Gera um OperationCanceledException se esse token tiver tido o cancelamento solicitado.Throws a OperationCanceledException if this token has had cancellation requested.

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

Exceções

O token teve o cancelamento solicitado.The token has had cancellation requested.

O CancellationTokenSource associado foi descartado.The associated CancellationTokenSource has been disposed.

Comentários

Esse método fornece a funcionalidade equivalente a:This method provides functionality equivalent to:

C#C#

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

Aplica-se a

Veja também