CancellationToken.ThrowIfCancellationRequested Método

Definição

Gera um OperationCanceledException se esse token tiver tido o cancelamento solicitado.

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

Exceções

O token teve o cancelamento solicitado.

Comentários

Esse método fornece funcionalidade equivalente a:

C#

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

Aplica-se a

Confira também