DispatcherObject 類別

定義

表示與 Dispatcher 關聯的物件。Represents an object that is associated with a Dispatcher.

public ref class DispatcherObject abstract
public abstract class DispatcherObject
type DispatcherObject = class
Public MustInherit Class DispatcherObject
繼承
DispatcherObject
衍生

備註

只有建立 Dispatcher 的執行緒可以直接存取 DispatcherObjectOnly the thread that the Dispatcher was created on may access the DispatcherObject directly. 若要從建立 DispatcherObject 的執行緒以外的執行緒存取 DispatcherObject,請在與 Dispatcher 相關聯的 DispatcherObject 上呼叫 InvokeBeginInvokeTo access a DispatcherObject from a thread other than the thread the DispatcherObject was created on, call Invoke or BeginInvoke on the Dispatcher the DispatcherObject is associated with.

需要強制執行執行緒安全的 DispatcherObject 子類別,可以藉由在所有公用方法上呼叫 VerifyAccess 來執行此動作。Subclasses of DispatcherObject that need to enforce thread safety can do so by calling VerifyAccess on all public methods. 這可確保呼叫執行緒是 DispatcherObject 建立所在的執行緒。This guarantees the calling thread is the thread that the DispatcherObject was created on.

DispatcherObject 無法獨立具現化;也就是說,所有的函式都會受到保護。A DispatcherObject cannot be independently instantiated; that is, all constructors are protected.

衍生自 DispatcherObject 的物件具有線程親和性。Objects that derive from DispatcherObject have thread affinity.

衍生自 Freezable 的物件在凍結時是無限制執行緒。Objects that derive from Freezable are free-threaded when they are frozen. 如需詳細資訊,請參閱 Freezable 物件概觀For more information, see the Freezable Objects Overview.

建構函式

DispatcherObject()

DispatcherObject 類別的新執行個體初始化。Initializes a new instance of the DispatcherObject class.

屬性

Dispatcher

取得與這個 Dispatcher 關聯的 DispatcherObjectGets the Dispatcher this DispatcherObject is associated with.

方法

CheckAccess()

判斷呼叫的執行是否可以存取這個 DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
VerifyAccess()

請強制執行可以存取這個 DispatcherObject 的呼叫執行緒。Enforces that the calling thread has access to this DispatcherObject.

適用於

執行緒安全性

這個類型的任何公用 static 成員都是安全線程。Any public static members of this type are thread safe. 並非所有的執行個體成員都是安全執行緒。Any instance members are not guaranteed to be thread safe.

這個物件只能從建立它的執行緒存取。This object can be accessed only from the thread on which it was created. 嘗試從其他執行緒存取它,將會擲回 InvalidOperationExceptionAttempts to access it from other threads will throw an InvalidOperationException. Invoke(DispatcherPriority, Delegate)BeginInvoke(DispatcherPriority, Delegate) 提供將工作封送處理至正確執行緒的支援。Invoke(DispatcherPriority, Delegate) or BeginInvoke(DispatcherPriority, Delegate) provide support for marshaling work to the correct thread.