Collapse the table of content
Expand the table of content

System.Runtime.InteropServices Namespace

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

The System.Runtime.InteropServices namespace provides types that support COM interop and platform invoke services.

Public classAllowReversePInvokeCallsAttributeAllows an unmanaged method to call a managed method.
Public classClassInterfaceAttributeInfrastructure. Indicates the type of class interface to be generated for a class exposed to COM, if an interface is generated at all.
Public classCoClassAttributeInfrastructure. Specifies the class identifier of a coclass imported from a type library.
Public classComDefaultInterfaceAttributeInfrastructure. Specifies a default interface to expose to COM. This class cannot be inherited.
Public classCOMExceptionInfrastructure. The exception that is thrown when an unrecognized HRESULT is returned from a COM method call.
Public classComImportAttributeInfrastructure. Indicates that the attributed type was previously defined in COM.
Public classComVisibleAttributeInfrastructure. Controls accessibility of an individual managed type or member, or of all types within an assembly, to COM.
Public classCriticalHandleInfrastructure. Represents a wrapper class for handle resources.
Public classDefaultCharSetAttributeInfrastructure. Specifies the value of the CharSet enumeration. This class cannot be inherited.
Public classDispIdAttributeInfrastructure. Specifies the COM dispatch identifier (DISPID) of a method, field, or property.
Public classDllImportAttributeInfrastructure. Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point.
Public classExternalExceptionInfrastructure. The base exception type for all COM interop exceptions and structured exception handling (SEH) exceptions.
Public classFieldOffsetAttributeInfrastructure. Indicates the physical position of fields within the managed and unmanaged representation of a class or structure.
Public classGuidAttributeInfrastructure. Supplies an explicit System.Guid when an automatic GUID is undesirable.
Public classInAttributeInfrastructure. Indicates that data should be marshaled from the caller to the callee, but not back to the caller.
Public classInterfaceTypeAttributeInfrastructure. Indicates whether a managed interface is dual, dispatch-only, or IUnknown -only when exposed to COM.
Public classMarshalInfrastructure. Provides a collection of methods for allocating unmanaged memory, copying unmanaged memory blocks, and converting managed to unmanaged types, as well as other miscellaneous methods used when interacting with unmanaged code.
Public classMarshalAsAttributeInfrastructure. Indicates how to marshal the data between managed and unmanaged code.
Public classMarshalDirectiveExceptionInfrastructure. The exception that is thrown by the marshaler when it encounters a MarshalAsAttribute it does not support.
Public classOptionalAttributeInfrastructure. Indicates that a parameter is optional.
Public classOutAttributeInfrastructure. Indicates that data should be marshaled from callee back to caller.
Public classPreserveSigAttributeInfrastructure. Indicates that the HRESULT or retval signature transformation that takes place during COM interop calls should be suppressed.
Public classSafeHandleInfrastructure. Represents a wrapper class for operating system handles. This class must be inherited.
Public classSEHExceptionInfrastructure. Represents Structured Exception Handler (SEH) errors.
Public classStructLayoutAttributeInfrastructure. The StructLayoutAttribute class allows the user to control the physical layout of the data fields of a class or structure.
Public classUnmanagedFunctionPointerAttributeInfrastructure. Controls the marshaling behavior of a delegate signature passed as an unmanaged function pointer to or from unmanaged code. This class cannot be inherited.

Public structureGCHandleInfrastructure. Provides a means for accessing a managed object from unmanaged memory.

Public interfaceICustomQueryInterfaceEnables developers to provide a custom, managed implementation of the IUnknown::QueryInterface(REFIID riid, void **ppvObject) method.

Public enumerationCallingConventionInfrastructure. Specifies the calling convention required to call methods implemented in unmanaged code.
Public enumerationCharSetInfrastructure. Dictates which character set marshaled strings should use.
Public enumerationClassInterfaceTypeInfrastructure. Identifies the type of class interface that is generated for a class.
Public enumerationComInterfaceTypeInfrastructure. Identifies how to expose an interface to COM.
Public enumerationCustomQueryInterfaceModeIndicates whether IUnknown::QueryInterface calls can use the ICustomQueryInterface interface.
Public enumerationCustomQueryInterfaceResultProvides return values for the GetInterface method.
Public enumerationGCHandleTypeInfrastructure. Represents the types of handles the GCHandle class can allocate.
Public enumerationLayoutKindInfrastructure. Controls the layout of an object when exported to unmanaged code.
Public enumerationUnmanagedTypeInfrastructure. Identifies how to marshal parameters or fields to unmanaged code.

© 2017 Microsoft