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執行緒可以DispatcherObject直接存取。Only the thread that the Dispatcher was created on may access the DispatcherObject directly. 若要DispatcherObject從所建立之執行緒以外DispatcherObject的執行緒存取Dispatcher , 請在與相關InvokeBeginInvoke的上DispatcherObject呼叫或。To 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.

需要強制執行執行緒安全VerifyAccess 的子類別,可以藉由在所有公用方法上呼叫來執行此動作。DispatcherObjectSubclasses of DispatcherObject that need to enforce thread safety can do so by calling VerifyAccess on all public methods. 這可確保呼叫執行緒是建立所在的執行緒DispatcherObjectThis 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. 嘗試從其他執行緒存取它時, 將會InvalidOperationException擲回。Attempts 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.