共用方式為


CancellationToken.ThrowIfCancellationRequested 方法

定義

如果已要求取消這個語彙基元,則擲回 OperationCanceledException

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

例外狀況

已要求取消這個語彙基元。

備註

這個方法提供的功能相當於:

C#

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

適用於

另請參閱