Marshal.GetStartComSlot(Type) Method

Definition

Gets the first slot in the virtual function table (v-table or VTBL) that contains user-defined methods.

C#
[System.Security.SecurityCritical]
public static int GetStartComSlot(Type t);
C#
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static int GetStartComSlot(Type t);
C#
public static int GetStartComSlot(Type t);

Parameters

t
Type

A type that represents an interface or a class.

Returns

The first VTBL slot that contains user-defined methods. The first slot is 3 if the interface is based on IUnknown, and 7 if the interface is based on IDispatch.

Attributes

Exceptions

t is not visible from COM.

Remarks

This method returns the zero-based v-table number for an interface or a class. When used on a class, the slot number that is returned refers to the class interface for the class. If the class interface is auto-dispatch, this method always returns -1 to indicate that the dispatch-only interface does not expose a v-table to managed clients. You can use GetStartComSlot and Marshal.GetEndComSlot in conjunction with Marshal.GetMethodInfoForComSlot to pass slots within a specified range. For additional information, see Introducing the class interface.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0

See also