Marshal.GetMethodInfoForComSlot(Type, Int32, ComMemberType) Method

Definition

Retrieves a MemberInfo object for the specified virtual function table (v-table or VTBL) slot.

public:
 static System::Reflection::MemberInfo ^ GetMethodInfoForComSlot(Type ^ t, int slot, System::Runtime::InteropServices::ComMemberType % memberType);
public static System.Reflection.MemberInfo GetMethodInfoForComSlot (Type t, int slot, ref System.Runtime.InteropServices.ComMemberType memberType);
[System.Security.SecurityCritical]
public static System.Reflection.MemberInfo GetMethodInfoForComSlot (Type t, int slot, ref System.Runtime.InteropServices.ComMemberType memberType);
static member GetMethodInfoForComSlot : Type * int * ComMemberType -> System.Reflection.MemberInfo
[<System.Security.SecurityCritical>]
static member GetMethodInfoForComSlot : Type * int * ComMemberType -> System.Reflection.MemberInfo
Public Shared Function GetMethodInfoForComSlot (t As Type, slot As Integer, ByRef memberType As ComMemberType) As MemberInfo

Parameters

t
Type

The type for which the MemberInfo is to be retrieved.

slot
Int32

The VTBL slot.

memberType
ComMemberType

On successful return, one of the enumeration values that specifies the type of the member.

Returns

The object that represents the member at the specified VTBL slot.

Attributes

Exceptions

t is not visible from COM.

Remarks

The return value may be a FieldInfo, MethodInfo, or PropertyInfo object. The return value depends on the type of managed member that exists in the given COM slot (hence the generalized return type MemberInfo from which all three derive).

The zero-based slot number that is returned by this method accounts for three IUnknown and possibly four IDispatch methods, making the value of the first available slot either 3 or 7. GetMethodInfoForComSlot provides the opposite functionality of Marshal.GetComSlotForMethodInfo. You can use Marshal.GetEndComSlot and Marshal.GetStartComSlot in conjunction with GetMethodInfoForComSlot to pass slots within a specified range.

The memberType parameter is important only on return. It contains the type of the COM member (a regular method or a property accessor) that corresponds to the returned MemberInfo object.

Applies to

See also