The namespace provides a wide variety of members that support COM interop and platform invoke services. If you are unfamiliar with these services, see Interoperating with Unmanaged Code.
Allows an unmanaged method to call a managed method.
Specifies whether the type should be marshaled using the Automation marshaler or a custom proxy and stub.
Controls whether Unicode characters are converted to the closest matching ANSI characters.
Marshals data of type VT_BSTR from managed to unmanaged code. This class cannot be inherited.
Indicates the type of class interface to be generated for a class exposed to COM, if an interface is generated at all.
Specifies the class identifier of a coclass imported from a type library.
Indicates the COM alias for a parameter or field type.
Permits late-bound registration of an event handler.
Indicates to a COM client that all classes in the current version of an assembly are compatible with classes in an earlier version of the assembly.
Indicates that information was lost about a class or interface when it was imported from a type library to an assembly.
Specifies a default interface to expose to COM. This class cannot be inherited.
Identifies the source interface and the class that implements the methods of the event interface that is generated when a coclass is imported from a COM type library.
Provides methods that enable .NET Framework delegates that handle events to be added and removed from COM objects.
The exception that is thrown when an unrecognized HRESULT is returned from a COM method call.
Indicates that the attributed type was previously defined in COM.
Specifies the method to call when you register an assembly for use from COM; this enables the execution of user-written code during the registration process.
Identifies a list of interfaces that are exposed as COM event sources for the attributed class.
Specifies the method to call when you unregister an assembly for use from COM; this allows for the execution of user-written code during the unregistration process.
Controls accessibility of an individual managed type or member, or of all types within an assembly, to COM.
Represents a wrapper class for handle resources.
Wraps objects the marshaler should marshal as a VT_CY.
Specifies the value of the CharSet enumeration. This class cannot be inherited.
Specifies the paths that are used to search for DLLs that provide functions for platform invokes.
Sets the default value of a parameter when called from a language that supports default parameters. This class cannot be inherited.
Wraps objects the marshaler should marshal as a VT_DISPATCH.
Specifies the COM dispatch identifier (DISPID) of a method, field, or property.
Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point.
Wraps objects the marshaler should marshal as a VT_ERROR.
Enables customization of managed objects that extend from unmanaged objects during creation.
The base exception type for all COM interop exceptions and structured exception handling (SEH) exceptions.
Indicates the physical position of fields within the unmanaged representation of a class or structure.
Supplies an explicit System.Guid when an automatic GUID is undesirable.
Tracks outstanding handles and forces a garbage collection when the specified threshold is reached.
已过时。Indicates which IDispatch implementation the common language runtime uses when exposing dual interfaces and dispinterfaces to COM.
Indicates that the types defined within an assembly were originally defined in a type library.
Indicates that data should be marshaled from the caller to the callee, but not back to the caller.
Indicates whether a managed interface is dual, dispatch-only, or IUnknown -only when exposed to COM.
The exception thrown when an invalid COM object is used.
The exception thrown by the marshaler when it encounters an argument of a variant type that can not be marshaled to managed code.
Indicates that a method's unmanaged signature expects a locale identifier (LCID) parameter.
Provides support for user customization of interop stubs in managed-to-COM interop scenarios.
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.
Indicates how to marshal the data between managed and unmanaged code.
The exception that is thrown by the marshaler when it encounters a MarshalAsAttribute it does not support.
Indicates that a parameter is optional.
Indicates that data should be marshaled from callee back to caller.
Indicates that the HRESULT or retval signature transformation that takes place during COM interop calls should be suppressed.
Indicates that the attributed assembly is a primary interop assembly.
Allows the user to specify the ProgID of a class.
Provides a set of services for registering and unregistering managed assemblies for use from COM.
Provides a collection of static methods that return information about the common language runtime environment.
The exception thrown when the rank of an incoming SAFEARRAY does not match the rank specified in the managed signature.
The exception thrown when the type of the incoming SAFEARRAY does not match the type specified in the managed signature.
Provides a controlled memory buffer that can be used for reading and writing. Attempts to access memory outside the controlled buffer (underruns and overruns) raise exceptions.
Represents a wrapper class for operating system handles. This class must be inherited.
Represents structured exception handling (SEH) errors.
已过时。This attribute has been deprecated.
Replaces the standard common language runtime (CLR) free-threaded marshaler with the standard OLE STA marshaler.
Lets you control the physical layout of the data fields of a class or structure in memory.
Provides support for type equivalence.
Provides a set of services that convert a managed assembly to a COM type library and vice versa.
Contains the FUNCFLAGS that were originally imported for this method from the COM type library.
Specifies which Type exclusively uses an interface. This class cannot be inherited.
Contains the TYPEFLAGS that were originally imported for this type from the COM type library.
Contains the VARFLAGS that were originally imported for this field from the COM type library.
Specifies the version number of an exported type library.
Wraps objects the marshaler should marshal as a VT_UNKNOWN.
Controls the marshaling behavior of a delegate signature passed as an unmanaged function pointer to or from unmanaged code. This class cannot be inherited.
Marshals data of type VT_VARIANT | VT_BYREF from managed to unmanaged code. This class cannot be inherited.
Creates a COM object.
Defines a set of flags used when registering assemblies.
已过时。Use System.Runtime.InteropServices.ComTypes.CALLCONV instead.
Specifies the calling convention required to call methods implemented in unmanaged code.
Dictates which character set marshaled strings should use.
Identifies the type of class interface that is generated for a class.
Identifies how to expose an interface to COM.
Describes the type of a COM member.
Indicates whether the GetComInterfaceForObject(Object,Type,CustomQueryInterfaceMode) method's IUnknown::QueryInterface calls can use the ICustomQueryInterface interface.
Provides return values for the GetInterface method.
已过时。Use System.Runtime.InteropServices.ComTypes.DESCKIND instead.
Specifies the paths that are used to search for DLLs that provide functions for platform invokes.
Describes the callbacks that the type library exporter makes when exporting a type library.
已过时。Use System.Runtime.InteropServices.ComTypes.FUNCFLAGS instead.
已过时。Use System.Runtime.InteropServices.ComTypes.FUNCKIND instead.
Represents the types of handles the GCHandle class can allocate.
已过时。Indicates which IDispatch implementation to use for a particular class.
已过时。Use System.Runtime.InteropServices.ComTypes.IDLFLAG instead.
已过时。Use System.Runtime.InteropServices.ComTypes.IMPLTYPEFLAGS instead.
Describes the callbacks that the type library importer makes when importing a type library.
已过时。Use System.Runtime.InteropServices.ComTypes.INVOKEKIND instead.
Controls the layout of an object when exported to unmanaged code.
已过时。Use System.Runtime.InteropServices.ComTypes.LIBFLAGS instead.
已过时。Use System.Runtime.InteropServices.ComTypes.PARAMFLAG instead.
Specifies the set of execution contexts in which a class object will be made available for requests to construct instances.
Defines the types of connections to a class object.
已过时。Use System.Runtime.InteropServices.ComTypes.SYSKIND instead.
已过时。Use System.Runtime.InteropServices.ComTypes.TYPEFLAGS instead.
已过时。Use System.Runtime.InteropServices.ComTypes.TYPEKIND instead.
Indicates how a type library should be produced.
Describes the original settings of the FUNCFLAGS in the COM type library from where this method was imported.
Indicates how an assembly should be produced.
Describes the original settings of the TYPEFLAGS in the COM type library from which the type was imported.
Describes the original settings of the VARFLAGS in the COM type library from which the variable was imported.
Identifies how to marshal parameters or fields to unmanaged code.
Indicates how to marshal the array elements when an array is marshaled from managed to unmanaged code as a UnmanagedType.SafeArray.
已过时。Use System.Runtime.InteropServices.ComTypes.VARFLAGS instead.
Members of this namespace provide several categories of functionality, as shown in the following table. Attributes control marshaling behavior, such as how to arrange structures or how to represent strings. The most important attributes are DllImportAttribute, which you use to define platform invoke methods for accessing unmanaged APIs, and MarshalAsAttribute, which you use to specify how data is marshaled between managed and unmanaged memory.