DispatcherObject DispatcherObject DispatcherObject DispatcherObject Class

定义

表示与 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
继承
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.

一个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() DispatcherObject() DispatcherObject()

初始化 DispatcherObject 类的新实例。Initializes a new instance of the DispatcherObject class.

属性

Dispatcher Dispatcher Dispatcher Dispatcher

获取与此 Dispatcher 关联的 DispatcherObjectGets 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 的浅表副本。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()

强制调用线程具有此 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 marshalling work to the correct thread.