DispatcherObject DispatcherObject DispatcherObject DispatcherObject Class

定義

表示相關聯的物件DispatcherRepresents an object that is associated with a Dispatcher.

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

備註

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

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.

ADispatcherObject無法獨立執行個體化; 也就是所有建構函式受到保護。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() DispatcherObject() DispatcherObject()

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

屬性

Dispatcher Dispatcher Dispatcher Dispatcher

取得DispatcherDispatcherObject相關聯。Gets the Dispatcher this DispatcherObject is associated with.

方法

CheckAccess() CheckAccess() CheckAccess() CheckAccess()

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

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

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)
VerifyAccess() VerifyAccess() VerifyAccess() VerifyAccess()

強制執行呼叫的執行緒可以存取這個DispatcherObjectEnforces 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.