UnmanagedMarshal.DefineSafeArray(UnmanagedType) 方法

定义

指定要封送为非托管代码的 SafeArraySpecifies a SafeArray to marshal to unmanaged code.

public:
 static System::Reflection::Emit::UnmanagedMarshal ^ DefineSafeArray(System::Runtime::InteropServices::UnmanagedType elemType);
public static System.Reflection.Emit.UnmanagedMarshal DefineSafeArray (System.Runtime.InteropServices.UnmanagedType elemType);
static member DefineSafeArray : System.Runtime.InteropServices.UnmanagedType -> System.Reflection.Emit.UnmanagedMarshal
Public Shared Function DefineSafeArray (elemType As UnmanagedType) As UnmanagedMarshal

参数

elemType
UnmanagedType

数组的每个元素的基类型或 UnmanagedTypeThe base type or the UnmanagedType of each element of the array.

返回

UnmanagedMarshal

一个 UnmanagedMarshal 对象。An UnmanagedMarshal object.

例外

该参数不是简单本机类型。The argument is not a simple native type.

注解

DefineSafeArray方法不是简单的本机封送。The DefineSafeArray method is not a simple native marshal.

只有非托管封送构造才能使用这些静态构造函数。Only unmanaged marshal constructs can be made using these static constructors.

与封送处理整数参数相比,封送数组是一个更复杂的过程。Marshaling an array is a more complex process than marshaling an integer parameter. 数组成员按特定顺序进行复制,以便另一方可以完全重建数组。Array members are copied in a specific order so that the other side can reconstruct the array exactly.

适用于

另请参阅