CancellationTokenRegistration CancellationTokenRegistration CancellationTokenRegistration CancellationTokenRegistration Struct

定義

表示已向 CancellationToken 登錄的回呼委派。Represents a callback delegate that has been registered with a CancellationToken.

public value class CancellationTokenRegistration : IDisposable, IEquatable<System::Threading::CancellationTokenRegistration>
public struct CancellationTokenRegistration : IDisposable, IEquatable<System.Threading.CancellationTokenRegistration>
type CancellationTokenRegistration = struct
    interface IDisposable
Public Structure CancellationTokenRegistration
Implements IDisposable, IEquatable(Of CancellationTokenRegistration)
繼承
CancellationTokenRegistrationCancellationTokenRegistrationCancellationTokenRegistrationCancellationTokenRegistration
實作

備註

當取消語彙基元時,會呼叫回呼。The callback is called when the token is canceled. 若要取消註冊回呼,處置對應的註冊執行個體。To unregister a callback, dispose the corresponding Registration instance. 如需詳細資訊和程式碼範例,請參閱受控執行緒中的取消For more information and code examples see Cancellation in Managed Threads.

屬性

Token Token Token Token

方法

Dispose() Dispose() Dispose() Dispose()

釋放 CancellationTokenRegistration 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the CancellationTokenRegistration class.

DisposeAsync() DisposeAsync() DisposeAsync() DisposeAsync()
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷目前的 CancellationTokenRegistration 執行個體與指定的 CancellationTokenRegistration 是否相等。Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration.

Equals(CancellationTokenRegistration) Equals(CancellationTokenRegistration) Equals(CancellationTokenRegistration) Equals(CancellationTokenRegistration)

判斷目前的 CancellationTokenRegistration 執行個體與指定的 CancellationTokenRegistration 是否相等。Determines whether the current CancellationTokenRegistration instance is equal to the specified CancellationTokenRegistration.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為 CancellationTokenRegistration 的雜湊函式。Serves as a hash function for a CancellationTokenRegistration.

Unregister() Unregister() Unregister() Unregister()

運算子

Equality(CancellationTokenRegistration, CancellationTokenRegistration) Equality(CancellationTokenRegistration, CancellationTokenRegistration) Equality(CancellationTokenRegistration, CancellationTokenRegistration) Equality(CancellationTokenRegistration, CancellationTokenRegistration)

判斷兩個 CancellationTokenRegistration 執行個體是否相等。Determines whether two CancellationTokenRegistration instances are equal.

Inequality(CancellationTokenRegistration, CancellationTokenRegistration) Inequality(CancellationTokenRegistration, CancellationTokenRegistration) Inequality(CancellationTokenRegistration, CancellationTokenRegistration) Inequality(CancellationTokenRegistration, CancellationTokenRegistration)

判斷兩個 CancellationTokenRegistration 執行個體是否不相等。Determines whether two CancellationTokenRegistration instances are not equal.

適用於

執行緒安全性

所有 public 和 protected 成員CancellationTokenRegistration是安全執行緒,而且同時從多個執行緒,除了 Dispose,僅能用於時使用上的所有其他作業CancellationTokenRegistration已完成。All public and protected members of CancellationTokenRegistration are thread-safe and may be used concurrently from multiple threads, with the exception of Dispose, which must only be used when all other operations on the CancellationTokenRegistration have completed.

另請參閱