System.Runtime.InteropServices 命名空间
类
AllowReversePInvokeCallsAttribute |
允许非托管方法调用托管方法。Allows an unmanaged method to call a managed method. |
AutomationProxyAttribute |
指定应使用自动化封送处理程序还是自定义代理和存根对类型进行封送处理。Specifies whether the type should be marshaled using the Automation marshaler or a custom proxy and stub. |
BestFitMappingAttribute |
控制是否将 Unicode 字符转换为最接近的匹配 ANSI 字符。Controls whether Unicode characters are converted to the closest matching ANSI characters. |
BStrWrapper |
将 |
ClassInterfaceAttribute |
指示在完全生成某个接口后为要向 COM 公开的类生成的类接口类型。Indicates the type of class interface to be generated for a class exposed to COM, if an interface is generated at all. |
CoClassAttribute |
指定从类型库中导入的 coclass 的类标识符。Specifies the class identifier of a coclass imported from a type library. |
ComAliasNameAttribute |
指示参数或字段类型的 COM 别名。Indicates the COM alias for a parameter or field type. |
ComAwareEventInfo |
允许事件处理程序的后期绑定注册。Permits late-bound registration of an event handler. |
ComCompatibleVersionAttribute |
向 COM 客户端指示程序集当前版本中的所有类与该程序集早期版本中的类兼容。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. |
ComConversionLossAttribute |
指示从类型库向程序集导入类或接口时丢失了有关信息。Indicates that information was lost about a class or interface when it was imported from a type library to an assembly. |
ComDefaultInterfaceAttribute |
指定要向 COM 公开的默认接口。Specifies a default interface to expose to COM. 此类不能被继承。This class cannot be inherited. |
ComEventInterfaceAttribute |
标识源接口和实现事件接口方法的类,事件接口在从 COM 类型库中导入组件类时生成。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. |
ComEventsHelper |
提供允许 .NET Framework 委托的方法,这些委托处理将从 COM 对象添加和删除的事件。Provides methods that enable .NET Framework delegates that handle events to be added and removed from COM objects. |
COMException |
当 COM 方法调用返回一个无法识别的 HRESULT 时引发的异常。The exception that is thrown when an unrecognized HRESULT is returned from a COM method call. |
ComImportAttribute |
指示该属性化类型是以前在 COM 中定义的。Indicates that the attributed type was previously defined in COM. |
ComRegisterFunctionAttribute |
指定从 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. |
ComSourceInterfacesAttribute |
为属性化类标识公开为 COM 事件源的一组接口。Identifies a list of interfaces that are exposed as COM event sources for the attributed class. |
ComUnregisterFunctionAttribute |
指定从 COM 中注销使用的程序集时要调用的方法;这可以在注销过程中执行用户编写的代码。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. |
ComVisibleAttribute |
控制程序集中单独托管类型或成员,或所有类型对 COM 的访问性。Controls accessibility of an individual managed type or member, or of all types within an assembly, to COM. |
CriticalHandle |
表示句柄资源的包装类。Represents a wrapper class for handle resources. |
CurrencyWrapper |
对封送处理程序应该将其作为 |
DefaultCharSetAttribute |
指定 CharSet 枚举的值。Specifies the value of the CharSet enumeration. 此类不能被继承。This class cannot be inherited. |
DefaultDllImportSearchPathsAttribute |
指定用于搜索提供平台调用功能的 DLL 的路径。Specifies the paths that are used to search for DLLs that provide functions for platform invokes. |
DefaultParameterValueAttribute |
设置当从支持默认参数的语言中调用参数时参数的默认值。Sets the default value of a parameter when called from a language that supports default parameters. 此类不能被继承。This class cannot be inherited. |
DispatchWrapper |
对封送处理程序应该将其作为 |
DispIdAttribute |
指定方法、字段或属性的 COM 调度标识符 (DISPID)。Specifies the COM dispatch identifier (DISPID) of a method, field, or property. |
DllImportAttribute |
指示该属性化方法由非托管动态链接库 (DLL) 作为静态入口点公开。Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point. |
ErrorWrapper |
对封送处理程序应该将其作为 |
ExtensibleClassFactory |
在创建过程中启用从非托管对象扩展的托管对象的自定义。Enables customization of managed objects that extend from unmanaged objects during creation. |
ExternalException |
所有 COM 互操作 异常和结构化异常处理 (SEH) 异常的异常基类型。The base exception type for all COM interop exceptions and structured exception handling (SEH) exceptions. |
FieldOffsetAttribute |
指示字段在类或结构的非托管表示形式内的物理位置。Indicates the physical position of fields within the unmanaged representation of a class or structure. |
GuidAttribute |
当不需要自动 GUID 时提供显式的 Guid。Supplies an explicit Guid when an automatic GUID is undesirable. |
HandleCollector |
跟踪未完成的句柄并在达到指定阈值时强制实施垃圾回收。Tracks outstanding handles and forces a garbage collection when the specified threshold is reached. |
IDispatchImplAttribute |
指示当向 COM 公开双重接口和调度接口时公共语言运行时使用何种 |
ImportedFromTypeLibAttribute |
指示在程序集内定义的类型原来在类型库中定义。Indicates that the types defined within an assembly were originally defined in a type library. |
InAttribute |
指示应将数据从调用方封送到被调用方,而不返回到调用方。Indicates that data should be marshaled from the caller to the callee, but not back to the caller. |
InterfaceTypeAttribute |
指示向 COM 公开时,托管接口是双重的、仅支持调度的、还是仅支持 |
InvalidComObjectException |
当使用无效的 COM 对象时引发的异常。The exception thrown when an invalid COM object is used. |
InvalidOleVariantTypeException |
封送拆收器在遇到不能封送到托管代码的 Variant 类型的参数时引发的异常。The exception thrown by the marshaler when it encounters an argument of a variant type that can not be marshaled to managed code. |
LCIDConversionAttribute |
指示方法的非托管签名需要区域设置标识符 (LCID) 参数。Indicates that a method's unmanaged signature expects a locale identifier (LCID) parameter. |
ManagedToNativeComInteropStubAttribute |
为用户在托管与 COM 互操作方案中自定义互操作存根提供支持。Provides support for user customization of interop stubs in managed-to-COM interop scenarios. |
Marshal |
提供了一个方法集合,这些方法用于分配非托管内存、复制非托管内存块、将托管类型转换为非托管类型,此外还提供了在与非托管代码交互时使用的其他杂项方法。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. |
MarshalAsAttribute |
指示如何在托管代码与非托管代码之间封送数据。Indicates how to marshal the data between managed and unmanaged code. |
MarshalDirectiveException |
当封送拆收器遇到它不支持的 MarshalAsAttribute 时由该封送拆收器引发的异常。The exception that is thrown by the marshaler when it encounters a MarshalAsAttribute it does not support. |
MemoryMarshal |
提供与 Memory<T>、ReadOnlyMemory<T>、Span<T> 和 ReadOnlySpan<T> 进行交互操作的方法。Provides methods to interoperate with Memory<T>, ReadOnlyMemory<T>, Span<T>, and ReadOnlySpan<T>. |
NativeLibrary |
提供用于管理本机库的 API。Provides APIs for managing native libraries. |
OptionalAttribute |
指示参数是可选的。Indicates that a parameter is optional. |
OutAttribute |
指示应将数据从被调用方封送回调用方。Indicates that data should be marshaled from callee back to caller. |
PreserveSigAttribute |
指示应取消在 COM 互操作调用期间发生的 HRESULT 或 |
PrimaryInteropAssemblyAttribute |
指示该特性化的程序集是主互操作程序集。Indicates that the attributed assembly is a primary interop assembly. |
ProgIdAttribute |
允许用户指定类的 ProgID。Allows the user to specify the ProgID of a class. |
RegistrationServices |
提供一组用于注册和注销托管程序集以供从 COM 使用的服务。Provides a set of services for registering and unregistering managed assemblies for use from COM. |
RuntimeEnvironment |
提供一个返回有关公共语言运行时环境的信息的 |
RuntimeInformation |
提供有关 .NET 运行时安装的信息。Provides information about the .NET runtime installation. |
SafeArrayRankMismatchException |
传入的 |
SafeArrayTypeMismatchException |
传入的 |
SafeBuffer |
提供可用于读取和写入的受控内存缓冲区。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. |
SafeHandle |
表示操作系统句柄的包装类。Represents a wrapper class for operating system handles. 必须继承此类。This class must be inherited. |
SEHException |
表示结构化异常处理 (SEH) 错误。Represents structured exception handling (SEH) errors. |
SequenceMarshal |
提供与 ReadOnlySequence<T> 进行互操作的方法集合。Provides a collection of methods for interoperating with ReadOnlySequence<T>. |
SetWin32ContextInIDispatchAttribute |
此特性已弃用。This attribute has been deprecated. |
StandardOleMarshalObject |
用标准 OLE STA 封送拆收器替换标准公共语言运行时 (CLR) 自由线程封送拆收器。Replaces the standard common language runtime (CLR) free-threaded marshaler with the standard OLE STA marshaler. |
StructLayoutAttribute |
允许你控制内存中类或结构的数据字段的物理布局。Lets you control the physical layout of the data fields of a class or structure in memory. |
TypeIdentifierAttribute |
提供对类型等效性的支持。Provides support for type equivalence. |
TypeLibConverter |
提供一组服务,这些服务将托管程序集转换为 COM 类型库或进行反向转换。Provides a set of services that convert a managed assembly to a COM type library and vice versa. |
TypeLibFuncAttribute |
包含最初从 COM 类型库为此方法导入的 FUNCFLAGS。Contains the FUNCFLAGS that were originally imported for this method from the COM type library. |
TypeLibImportClassAttribute |
指定哪个 Type 独占使用接口。Specifies which Type exclusively uses an interface. 此类不能被继承。This class cannot be inherited. |
TypeLibTypeAttribute |
包含最初为此类型从 COM 类型库导入的 TYPEFLAGS。Contains the TYPEFLAGS that were originally imported for this type from the COM type library. |
TypeLibVarAttribute |
包含最初为此字段从 COM 类型库导入的 VARFLAGS。Contains the VARFLAGS that were originally imported for this field from the COM type library. |
TypeLibVersionAttribute |
指定已导出类型库的版本号。Specifies the version number of an exported type library. |
UnknownWrapper |
对封送处理程序应该将其作为 |
UnmanagedFunctionPointerAttribute |
控制作为非托管函数指针传递到非托管代码(或从非托管代码中传递)的委托签名的封送处理行为。Controls the marshaling behavior of a delegate signature passed as an unmanaged function pointer to or from unmanaged code. 此类不能被继承。This class cannot be inherited. |
VariantWrapper |
将 |
结构
ArrayWithOffset |
封装指定数组内的数组和偏移量。Encapsulates an array and an offset within the specified array. |
BIND_OPTS | |
BINDPTR | |
CONNECTDATA |
请改用 CONNECTDATA。Use CONNECTDATA instead. |
DISPPARAMS |
请改用 DISPPARAMS。Use DISPPARAMS instead. |
ELEMDESC | |
ELEMDESC.DESCUNION |
请改用 ELEMDESC.DESCUNION。Use ELEMDESC.DESCUNION instead. |
EXCEPINFO | |
FILETIME | |
FUNCDESC | |
GCHandle |
提供用于从非托管内存访问托管对象的方法。Provides a way to access a managed object from unmanaged memory. |
HandleRef |
将包含句柄的托管对象包装到通过平台调用传递到非托管代码的资源中。Wraps a managed object holding a handle to a resource that is passed to unmanaged code using platform invoke. |
IDLDESC | |
OSPlatform |
表示一种操作系统平台。Represents an operating system platform. |
PARAMDESC | |
STATSTG | |
TYPEATTR | |
TYPEDESC | |
TYPELIBATTR |
请改用 TYPELIBATTR。Use TYPELIBATTR instead. |
VARDESC | |
VARDESC.DESCUNION |
请改用 VARDESC.DESCUNION。Use VARDESC.DESCUNION instead. |
接口
_Activator |
向非托管代码公开 Activator 类。Exposes the Activator class to unmanaged code. |
_Assembly |
向非托管代码公开 Assembly 类的公共成员。Exposes the public members of the Assembly class to unmanaged code. |
_AssemblyBuilder |
向非托管代码公开 AssemblyBuilder 类。Exposes the AssemblyBuilder class to unmanaged code. |
_AssemblyName |
向非托管代码公开 AssemblyName 类。Exposes the AssemblyName class to unmanaged code. |
_Attribute |
向非托管代码公开 Attribute 类。Exposes the Attribute class to unmanaged code. |
_ConstructorBuilder |
向非托管代码公开 ConstructorBuilder 类。Exposes the ConstructorBuilder class to unmanaged code. |
_ConstructorInfo |
向非托管代码公开 ConstructorInfo 类的公共成员。Exposes the public members of the ConstructorInfo class to unmanaged code. |
_CustomAttributeBuilder |
向非托管代码公开 CustomAttributeBuilder 类。Exposes the CustomAttributeBuilder class to unmanaged code. |
_EnumBuilder |
向非托管代码公开 EnumBuilder 类。Exposes the EnumBuilder class to unmanaged code. |
_EventBuilder |
向非托管代码公开 EventBuilder 类。Exposes the EventBuilder class to unmanaged code. |
_EventInfo |
向非托管代码公开 EventInfo 类的公共成员。Exposes the public members of the EventInfo class to unmanaged code. |
_Exception |
向非托管代码公开 Exception 类的公共成员。Exposes the public members of the Exception class to unmanaged code. |
_FieldBuilder |
向非托管代码公开 FieldBuilder 类。Exposes the FieldBuilder class to unmanaged code. |
_FieldInfo |
向非托管代码公开 FieldInfo 类的公共成员。Exposes the public members of the FieldInfo class to unmanaged code. |
_ILGenerator |
向非托管代码公开 ILGenerator 类。Exposes the ILGenerator class to unmanaged code. |
_LocalBuilder |
向非托管代码公开 LocalBuilder 类。Exposes the LocalBuilder class to unmanaged code. |
_MemberInfo |
向非托管代码公开 MemberInfo 类的公共成员。Exposes the public members of the MemberInfo class to unmanaged code. |
_MethodBase |
向非托管代码公开 MethodBase 类的公共成员。Exposes the public members of the MethodBase class to unmanaged code. |
_MethodBuilder |
向非托管代码公开 MethodBuilder 类。Exposes the MethodBuilder class to unmanaged code. |
_MethodInfo |
向非托管代码公开 MethodInfo 类的公共成员。Exposes the public members of the MethodInfo class to unmanaged code. |
_MethodRental |
向非托管代码公开 MethodRental 类。Exposes the MethodRental class to unmanaged code. |
_Module |
向非托管代码公开 Module 类。Exposes the Module class to unmanaged code. |
_ModuleBuilder |
向非托管代码公开 ModuleBuilder 类。Exposes the ModuleBuilder class to unmanaged code. |
_ParameterBuilder |
向非托管代码公开 ParameterBuilder 类。Exposes the ParameterBuilder class to unmanaged code. |
_ParameterInfo |
向非托管代码公开 ParameterInfo 类。Exposes the ParameterInfo class to unmanaged code. |
_PropertyBuilder |
向非托管代码公开 PropertyBuilder 类。Exposes the PropertyBuilder class to unmanaged code. |
_PropertyInfo |
向非托管代码公开 PropertyInfo 类的公共成员。Exposes the public members of the PropertyInfo class to unmanaged code. |
_SignatureHelper |
向非托管代码公开 SignatureHelper 类。Exposes the SignatureHelper class to unmanaged code. |
_Thread |
向非托管代码公开 Thread 类。Exposes the Thread class to unmanaged code. |
_Type |
向非托管代码公开 Type 类的公共成员。Exposes the public members of the Type class to the unmanaged code. |
_TypeBuilder |
向非托管代码公开 TypeBuilder 类。Exposes the TypeBuilder class to unmanaged code. |
ICustomAdapter |
为客户提供访问实际对象的方法,而不是访问自定义封送处理程序分发的适配器对象的方法。Provides a way for clients to access the actual object, rather than the adapter object handed out by a custom marshaler. |
ICustomFactory |
使用户能够为扩展 MarshalByRefObject 的托管对象编写激活代码。Enables users to write activation code for managed objects that extend MarshalByRefObject. |
ICustomMarshaler |
提供用于处理方法调用的自定义包装器。Provides custom wrappers for handling method calls. |
ICustomQueryInterface |
允许开发人员提供 IUnknown::QueryInterface(REFIID riid, void **ppvObject) 方法的自定义托管实现。Enables developers to provide a custom, managed implementation of the IUnknown::QueryInterface(REFIID riid, void **ppvObject) method. |
IRegistrationServices |
提供一组用于注册和注销托管程序集以供从 COM 使用的服务。Provides a set of services for registering and unregistering managed assemblies for use from COM. |
ITypeLibConverter |
提供一组服务,这些服务将托管程序集转换为 COM 类型库或进行反向转换。Provides a set of services that convert a managed assembly to a COM type library and vice versa. |
ITypeLibExporterNameProvider |
当导出到类型库时提供名称大小写控制。Provides control over the casing of names when exported to a type library. |
ITypeLibExporterNotifySink |
提供回叫机制,以供程序集转换器向调用方通知转换的状态,并在转换过程本身之中涉及调用方。Provides a callback mechanism for the assembly converter to inform the caller of the status of the conversion, and involve the caller in the conversion process itself. |
ITypeLibImporterNotifySink |
提供回叫机制,以供类型库转换器向调用方通知转换的状态,并在转换过程本身之中涉及调用方。Provides a callback mechanism for the type library converter to inform the caller of the status of the conversion, and involve the caller in the conversion process itself. |
UCOMIBindCtx | |
UCOMIConnectionPoint |
请改用 IConnectionPoint。Use IConnectionPoint instead. |
UCOMIConnectionPointContainer |
请改用 IConnectionPointContainer。Use IConnectionPointContainer instead. |
UCOMIEnumConnectionPoints |
请改用 IEnumConnectionPoints。Use IEnumConnectionPoints instead. |
UCOMIEnumConnections |
请改用 IEnumConnections。Use IEnumConnections instead. |
UCOMIEnumMoniker |
请改用 IEnumMoniker。Use IEnumMoniker instead. |
UCOMIEnumString |
请改用 IEnumString。Use IEnumString instead. |
UCOMIEnumVARIANT |
请改用 IEnumVARIANT。Use IEnumVARIANT instead. |
UCOMIMoniker | |
UCOMIPersistFile |
请改用 IPersistFile。Use IPersistFile instead. |
UCOMIRunningObjectTable |
请改用 IRunningObjectTable。Use IRunningObjectTable instead. |
UCOMIStream | |
UCOMITypeComp | |
UCOMITypeInfo | |
UCOMITypeLib |
枚举
Architecture |
指示处理器体系结构。Indicates the processor architecture. |
AssemblyRegistrationFlags |
定义注册程序集时使用的一组标志。Defines a set of flags used when registering assemblies. |
CALLCONV | |
CallingConvention |
指定调用在非托管代码中实现的方法所需的调用约定。Specifies the calling convention required to call methods implemented in unmanaged code. |
CharSet |
规定封送字符串应使用何种字符集。Dictates which character set marshaled strings should use. |
ClassInterfaceType |
标识为某个类生成的类接口的类型。Identifies the type of class interface that is generated for a class. |
ComInterfaceType |
标识如何向 COM 公开接口。Identifies how to expose an interface to COM. |
ComMemberType |
描述 COM 成员的类型。Describes the type of a COM member. |
CustomQueryInterfaceMode |
指示 GetComInterfaceForObject(Object, Type, CustomQueryInterfaceMode) 方法的 IUnknown::QueryInterface 调用是否可以使用 ICustomQueryInterface 接口。Indicates whether the GetComInterfaceForObject(Object, Type, CustomQueryInterfaceMode) method's IUnknown::QueryInterface calls can use the ICustomQueryInterface interface. |
CustomQueryInterfaceResult |
提供 GetInterface(Guid, IntPtr) 方法的返回值。Provides return values for the GetInterface(Guid, IntPtr) method. |
DESCKIND | |
DllImportSearchPath |
指定用于搜索提供平台调用功能的 DLL 的路径。Specifies the paths that are used to search for DLLs that provide functions for platform invokes. |
ExporterEventKind |
描述类型库导出程序在导出类型库时进行的回调。Describes the callbacks that the type library exporter makes when exporting a type library. |
FUNCFLAGS | |
FUNCKIND | |
GCHandleType |
表示 GCHandle 类可以分配的句柄的类型。Represents the types of handles the GCHandle class can allocate. |
IDispatchImplType |
指示将用于特定类的 |
IDLFLAG | |
IMPLTYPEFLAGS |
请改用 IMPLTYPEFLAGS。Use IMPLTYPEFLAGS instead. |
ImporterEventKind |
描述类型库导入程序在导入类型库时生成的回调。Describes the callbacks that the type library importer makes when importing a type library. |
INVOKEKIND |
请改用 INVOKEKIND。Use INVOKEKIND instead. |
LayoutKind |
控制当导出到非托管代码时对象的布局。Controls the layout of an object when exported to unmanaged code. |
LIBFLAGS | |
PARAMFLAG | |
RegistrationClassContext |
指定执行上下文集,类对象将在这些上下文中对请求构造实例的请求可用。Specifies the set of execution contexts in which a class object will be made available for requests to construct instances. |
RegistrationConnectionType |
定义到类对象的连接的类型。Defines the types of connections to a class object. |
SYSKIND | |
TYPEFLAGS | |
TYPEKIND | |
TypeLibExporterFlags |
指示应该如何生成类型库。Indicates how a type library should be produced. |
TypeLibFuncFlags |
描述从中导入该方法的 COM 类型库中 |
TypeLibImporterFlags |
指示应该如何生成程序集。Indicates how an assembly should be produced. |
TypeLibTypeFlags |
描述从中导入该类型的 COM 类型库中 TYPEFLAGS 的原始设置。Describes the original settings of the TYPEFLAGS in the COM type library from which the type was imported. |
TypeLibVarFlags |
描述从中导入该变量的 COM 类型库中 VARFLAGS 的原始设置。Describes the original settings of the VARFLAGS in the COM type library from which the variable was imported. |
UnmanagedType |
指定如何将参数或字段封送到非托管代码。Identifies how to marshal parameters or fields to unmanaged code. |
VarEnum |
指示当数组作为 SafeArray 从托管代码封送到非托管代码时,如何封送该数组的元素。Indicates how to marshal the array elements when an array is marshaled from managed to unmanaged code as a SafeArray. |
VARFLAGS |
委托
DllImportResolver |
提供用于通过回调解析本机库的委托。Provides a delegate used to resolve native libraries via callback. |
ObjectCreationDelegate |
创建 COM 对象。Creates a COM object. |
注解
此命名空间的成员提供多个类别的功能下, 表中所示。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. 最重要属性是DllImportAttribute,用于定义平台调用方法可以访问非托管的 Api 和MarshalAsAttribute,用于指定数据之间的封送托管和非托管内存。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.