CancellationToken.WaitHandle 屬性

定義

取得取消語彙基元時所發出的 WaitHandle 信號。Gets a WaitHandle that is signaled when the token is canceled.

public:
 property System::Threading::WaitHandle ^ WaitHandle { System::Threading::WaitHandle ^ get(); };
public System.Threading.WaitHandle WaitHandle { get; }
member this.WaitHandle : System.Threading.WaitHandle
Public ReadOnly Property WaitHandle As WaitHandle

屬性值

取消語彙基元時所發出的 WaitHandle 信號。A WaitHandle that is signaled when the token is canceled.

例外狀況

相關聯的 CancellationTokenSource 已經處置。The associated CancellationTokenSource has been disposed.

備註

存取此屬性會導致 WaitHandle 具現化。Accessing this property causes a WaitHandle to be instantiated. 最好只在必要時才使用此屬性,然後在最早的商機上處置相關聯的 CancellationTokenSource 實例(處置來源將會處置此配置的控制碼)。It is preferable to only use this property when necessary, and to then dispose the associated CancellationTokenSource instance at the earliest opportunity (disposing the source will dispose of this allocated handle). 控制碼不應直接關閉或處置。The handle should not be closed or disposed directly.

適用於

另請參閱