語言

Marshal.GetComSlotForMethodInfo(MemberInfo) 方法

定義

當特定類型暴露於 COM 時,會擷取該類型虛擬函式表(v-table 或 VTBL)插槽 MemberInfo 。

public:
 static int GetComSlotForMethodInfo(System::Reflection::MemberInfo ^ m);
public static int GetComSlotForMethodInfo(System.Reflection.MemberInfo m);
[System.Security.SecurityCritical]
public static int GetComSlotForMethodInfo(System.Reflection.MemberInfo m);
static member GetComSlotForMethodInfo : System.Reflection.MemberInfo -> int
[<System.Security.SecurityCritical>]
static member GetComSlotForMethodInfo : System.Reflection.MemberInfo -> int
Public Shared Function GetComSlotForMethodInfo (m As MemberInfo) As Integer

參數

m
MemberInfo

一個代表介面方法的物件。

傳回

VTBL 插槽 m 識別碼在暴露於 COM 時。

屬性

例外狀況

參數 m 為 null。

參數 m 不是 MemberInfo 物件。

-或-

這個 m 參數不是介面方法。

備註

此方法回傳的以零為基礎的槽位號碼涵蓋三個 IUnknown 及可能的 四個 IDispatch 方法,使得第一個可用槽位的值為 3 或 7。 GetComSlotForMethodInfo 提供與 Marshal.GetMethodInfoForComSlot相反的功能。

你可以用此方法取得介面成員(COM看不到)以及私有介面成員的槽位編號。 回傳的槽位號碼對應於若該類型暴露於 COM 時會保留的 v-table 編號。 COM 隱形成員實際上佔據了暴露 v-table 中的一個插槽,儘管 COM 用戶端無法使用該插槽。 你不能透過從類別傳遞GetComSlotForMethodInfo來在類別介面上使用MemberInfo。 更多資訊請參閱 「介紹類別介面」。

適用於

另請參閱