DispatchWrapper DispatchWrapper DispatchWrapper DispatchWrapper Class

定义

警告

此 API 现已过时。

对封送处理程序应该将其作为 VT_DISPATCH 封送的对象进行包装。Wraps objects the marshaler should marshal as a VT_DISPATCH.

public ref class DispatchWrapper sealed
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
[System.Obsolete("DispatchWrapper and support for marshalling to the VARIANT type may be unavailable in future releases.")]
public sealed class DispatchWrapper
type DispatchWrapper = class
Public NotInheritable Class DispatchWrapper
继承
DispatchWrapperDispatchWrapperDispatchWrapperDispatchWrapper
属性

注解

使用包装的对象封送处理程序应以封送VT_DISPATCHUse to wrap objects the marshaler should marshal as a VT_DISPATCH. 此包装器将强制对象进行封送出作为VT_DISPATCHThis wrapper will force objects to be marshaled out as VT_DISPATCH. 如果该对象不支持IDispatch则将引发异常。If the object does not support IDispatch then an exception will be thrown.

void MyMethod(Object^ o);

void DoWrap()
{
    Object^ o = gcnew MyObject();
    MyMethod(o);                        // passes o as VT_UNKNOWN
    MyMethod(gcnew DispatchWrapper(o)); // passes o as VT_DISPATCH

    //...
}
void MyMethod(Object o);

public void DoWrap()
{
    Object o = new MyObject();
    MyMethod(o);                      // passes o as VT_UNKNOWN
    MyMethod(new DispatchWrapper(o)); // passes o as VT_DISPATCH

    //...
}
Sub MyMethod(o As Object)
    ' handle object ...
End Sub

Public Sub DoWrap()
    Dim o As Object = new MyObject()
    MyMethod(o)                      ' passes o as VT_UNKNOWN
    MyMethod(new DispatchWrapper(o)) ' passes o as VT_DISPATCH

    '...
End Sub

有关详细信息VT_DISPATCH,现有的文档,请参阅VARENUM::VT_DISPATCHMSDN 库中。For more information on VT_DISPATCH, please see the existing documentation for VARENUM::VT_DISPATCH in the MSDN library.

构造函数

DispatchWrapper(Object) DispatchWrapper(Object) DispatchWrapper(Object) DispatchWrapper(Object)

使用正在包装的对象初始化 DispatchWrapper 类的新实例。Initializes a new instance of the DispatchWrapper class with the object being wrapped.

属性

WrappedObject WrappedObject WrappedObject WrappedObject

获取由 DispatchWrapper 包装的对象。Gets the object wrapped by the DispatchWrapper.

方法

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)

适用于