DispatchWrapper 類別

定義

警告

DispatchWrapper and support for marshalling to the VARIANT type may be unavailable in future releases.

包裝封送處理器應將其當做 VT_DISPATCH 來封送處理的物件。

public ref class DispatchWrapper sealed
[System.Obsolete("DispatchWrapper and support for marshalling to the VARIANT type may be unavailable in future releases.")]
public sealed class DispatchWrapper
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public sealed class DispatchWrapper
public sealed class DispatchWrapper
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class DispatchWrapper
[<System.Obsolete("DispatchWrapper and support for marshalling to the VARIANT type may be unavailable in future releases.")>]
type DispatchWrapper = class
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
type DispatchWrapper = class
type DispatchWrapper = class
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type DispatchWrapper = class
Public NotInheritable Class DispatchWrapper
繼承
DispatchWrapper
屬性

備註

用來包裝封送處理器應該封送處理為 VT_DISPATCH 的物件。 此包裝函式會強制將物件封送處理為 VT_DISPATCH 。 如果物件不支援 IDispatch ,則會擲回例外狀況。

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 ,請參閱 MSDN 文件庫中的現有檔 VARENUM::VT_DISPATCH

建構函式

DispatchWrapper(Object)

使用被包裝的物件,來初始化 DispatchWrapper 類別的新執行個體。

屬性

WrappedObject

取得 DispatchWrapper 所包裝的物件。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於