c# int[]转byte[]
byte[]转int[]
数据互转
可以扩展成其他的数组转byteint[] intArray = new int[3];
intArray[0] = 511;
intArray[1] = 512;
intArray[2] = 513;
byte[] result = new byte[intArray.Length * sizeof(int)];
Buffer.BlockCopy(intArray, 0, result, 0, result.Length);
//下面的是反转
int[] ints = new int[result.Length / sizeof(int)];
Buffer.BlockCopy(result, 0, ints, 0, result.Length);
foreach(var item in ints)
{
Console.WriteLine(":::::" + item);
}