Partager via


System.Runtime.InteropServices Namespace

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Classes

  Class Description
Public class AllowReversePInvokeCallsAttribute Allows an unmanaged method to call a managed method.
Public class ClassInterfaceAttribute Infrastructure. Indicates the type of class interface to be generated for a class exposed to COM, if an interface is generated at all.
Public class CoClassAttribute Infrastructure. Specifies the class identifier of a coclass imported from a type library.
Public class ComDefaultInterfaceAttribute Infrastructure. Specifies a default interface to expose to COM. This class cannot be inherited.
Public class COMException Infrastructure. The exception that is thrown when an unrecognized HRESULT is returned from a COM method call.
Public class ComImportAttribute Infrastructure. Indicates that the attributed type was previously defined in COM.
Public class ComVisibleAttribute Infrastructure. Controls accessibility of an individual managed type or member, or of all types within an assembly, to COM.
Public class CriticalHandle Infrastructure. Represents a wrapper class for handle resources.
Public class DefaultCharSetAttribute Infrastructure. Specifies the value of the CharSet enumeration. This class cannot be inherited.
Public class DispIdAttribute Infrastructure. Specifies the COM dispatch identifier (DISPID) of a method, field, or property.
Public class DllImportAttribute Infrastructure. Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point.
Public class ExternalException Infrastructure. The base exception type for all COM interop exceptions and structured exception handling (SEH) exceptions.
Public class FieldOffsetAttribute Infrastructure. Indicates the physical position of fields within the managed and unmanaged representation of a class or structure.
Public class GuidAttribute Infrastructure. Supplies an explicit System.Guid when an automatic GUID is undesirable.
Public class InAttribute Infrastructure. Indicates that data should be marshaled from the caller to the callee, but not back to the caller.
Public class InterfaceTypeAttribute Infrastructure. Indicates whether a managed interface is dual, dispatch-only, or IUnknown -only when exposed to COM.
Public class Marshal Infrastructure. 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 class MarshalAsAttribute Infrastructure. Indicates how to marshal the data between managed and unmanaged code.
Public class MarshalDirectiveException Infrastructure. The exception that is thrown by the marshaler when it encounters a MarshalAsAttribute it does not support.
Public class OptionalAttribute Infrastructure. Indicates that a parameter is optional.
Public class OutAttribute Infrastructure. Indicates that data should be marshaled from callee back to caller.
Public class PreserveSigAttribute Infrastructure. Indicates that the HRESULT or retval signature transformation that takes place during COM interop calls should be suppressed.
Public class SafeHandle Infrastructure. Represents a wrapper class for operating system handles. This class must be inherited.
Public class SEHException Infrastructure. Represents Structured Exception Handler (SEH) errors.
Public class StructLayoutAttribute Infrastructure. The StructLayoutAttribute class allows the user to control the physical layout of the data fields of a class or structure.
Public class UnmanagedFunctionPointerAttribute Infrastructure. Controls the marshaling behavior of a delegate signature passed as an unmanaged function pointer to or from unmanaged code. This class cannot be inherited.

Structures

  Structure Description
Public structure GCHandle Infrastructure. Provides a means for accessing a managed object from unmanaged memory.

Enumerations

  Enumeration Description
Public enumeration CallingConvention Infrastructure. Specifies the calling convention required to call methods implemented in unmanaged code.
Public enumeration CharSet Infrastructure. Dictates which character set marshaled strings should use.
Public enumeration ClassInterfaceType Infrastructure. Identifies the type of class interface that is generated for a class.
Public enumeration ComInterfaceType Infrastructure. Identifies how to expose an interface to COM.
Public enumeration GCHandleType Infrastructure. Represents the types of handles the GCHandle class can allocate.
Public enumeration LayoutKind Infrastructure. Controls the layout of an object when exported to unmanaged code.
Public enumeration UnmanagedType Infrastructure. Identifies how to marshal parameters or fields to unmanaged code.