UnmanagedMarshal 类

定义

注意

An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202

表示描述如何将字段从托管代码封送到非托管代码的类。 此类不能被继承。

public ref class UnmanagedMarshal sealed
[System.Serializable]
public sealed class UnmanagedMarshal
[System.Serializable]
[System.Obsolete("An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class UnmanagedMarshal
[<System.Serializable>]
type UnmanagedMarshal = class
[<System.Serializable>]
[<System.Obsolete("An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202")>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type UnmanagedMarshal = class
Public NotInheritable Class UnmanagedMarshal
继承
UnmanagedMarshal
属性

注解

该代码示例显示了此过时类型的解决方法。

封送处理是打包和解压缩参数的过程,因此可以进行远程过程调用。 封送处理期间,当托管类型的格式不同于相应非托管类型的格式时,字段可能会进行格式转换。 例如,你可能想要将类型 String 封送为非托管 BSTR。 某些格式转换由运行时自动处理。 若要替代默认行为,必须使用 UnmanagedMarshal 类来定义格式转换。

属性

名称 说明
BaseType
已过时.

获取非托管基类型。 此属性为只读。

ElementCount
已过时.

获取数字元素。 此属性为只读。

GetUnmanagedType
已过时.

指示非托管类型。 此属性为只读。

IIDGuid
已过时.

获取 GUID。 此属性为只读。

方法

名称 说明
DefineByValArray(Int32)
已过时.

指定要封送到非托管代码的固定长度数组(ByValArray)。

DefineByValTStr(Int32)
已过时.

指定要封送到非托管代码的固定数组缓冲区中的字符串(ByValTStr)。

DefineLPArray(UnmanagedType)
已过时.

指定要 LPArray 封送到非托管代码。 运行时的长度 LPArray 取决于实际封送数组的大小。

DefineSafeArray(UnmanagedType)
已过时.

指定要 SafeArray 封送到非托管代码的封送。

DefineUnmanagedMarshal(UnmanagedType)
已过时.

指定要封送给非托管代码的给定类型。

Equals(Object)
已过时.

确定指定的对象是否等于当前对象。

(继承自 Object)
GetHashCode()
已过时.

用作默认哈希函数。

(继承自 Object)
GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()
已过时.

创建当前 Object的浅表副本。

(继承自 Object)
ToString()
已过时.

返回一个表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅