首页  编辑  

从数组中读取一个整数

Tags: /C#/其他技巧/   Date Created:

using System . Runtime . InteropServices;

byte [] vBytes = { 0x12 , 0x34 , 0x56 , 0x78 };

IntPtr vBytesAddress = Marshal . UnsafeAddrOfPinnedArrayElement(vBytes, 0 );

int vInt = Marshal . ReadInt32(vBytesAddress);