System::Runtime::InteropServices::Marshal 类

Marshal class

提供编组实现。仅为与已翻译代码兼容,因为 C++ 端不支持托管代码。这是一个没有实例服务的静态类型。您绝不应以任何方式创建其实例。

class Marshal

方法

方法描述
static AllocHGlobal(int32_t)分配非托管内存。
static AllocHGlobal(IntPtr)分配非托管内存。
static Copy(const IntPtr, container&&, int, int)实现 public static void Copy(IntPtr source, byte[] destination, int startIndex, int length) 语义。
static Copy(const void *, container&&, int, int)实现 public static void Copy(IntPtr source, byte[] destination, int startIndex, int length) 语义。
static Copy(const container&, int, void *, int)实现 public static void Copy(char[] source, int startIndex, IntPtr destination, int length)。
static Copy(const container&, int, IntPtr, int)实现 public static void Copy(char[] source, int startIndex, IntPtr destination, int length)。
static FreeHGlobal(IntPtr)释放非托管内存。
static GetHRForException(const System::Exception&)从异常获取 HResult。
static PtrToStringAnsi(IntPtr)从非托管零终止 UTF8 字符串创建受管 String
static PtrToStringAnsi(IntPtr, int)从非托管 UTF8 字符串创建受管 String
static PtrToStringAuto(IntPtr)从非托管零终止字符串创建受管 String
static PtrToStringAuto(IntPtr, int)从非托管字符串创建受管 String
static PtrToStringUni(IntPtr)从非托管零终止 Unicode 字符串创建受管 String
static PtrToStringUni(IntPtr, int)从非托管 Unicode 字符串创建受管 String
static PtrToStringUTF8(IntPtr)从非托管零终止 UTF8 字符串创建受管 String
static PtrToStringUTF8(IntPtr, int)从非托管 UTF8 字符串创建受管 String
static ReadByte(IntPtr, int)从内存读取字节。
static ReadInt16(IntPtr, int)从内存读取短整数。
static ReadInt32(IntPtr, int)从内存读取整数。
static SecureStringToGlobalAllocAnsi(const SharedPtr<Security::SecureString>&)将指定安全字符串的内容复制到非托管内存,并转换为 ANSI 格式。
static SecureStringToGlobalAllocUnicode(const SharedPtr<Security::SecureString>&)将指定安全字符串的内容复制到非托管内存。
static StringToHGlobalAnsi(const String&)将指定字符串的内容复制到非托管内存。
static StringToHGlobalAuto(const String&)将指定字符串的内容复制到非托管内存,如有需要则转换为 ANSI 格式。
static StringToHGlobalUni(const String&)将指定字符串的内容复制到非托管内存。
static WriteByte(IntPtr, int, uint8_t)向内存写入字节。
static WriteByte(IntPtr, uint8_t)向内存写入字节。
static WriteInt16(IntPtr, int, int16_t)向内存写入短整数。
static WriteInt32(IntPtr, int, int32_t)向内存写入整数。
static WriteInt64(IntPtr, int, int64_t)向内存写入长整数。
static ZeroFreeGlobalAllocAnsi(IntPtr)释放使用 SecureStringToGlobalAllocAnsi 方法分配的非托管字符串指针。
static ZeroFreeGlobalAllocUnicode(IntPtr)释放使用 SecureStringToGlobalAllocUnicode 方法分配的非托管字符串指针。

另见