拼接:
byte[] header = Encoding.ASCII.GetBytes("$FSP") ;
byte[] img_size = new byte[4];
byte[] img ;
byte[] fullData ;
fullData = new byte[header.Length + img_size.Length+ img.Length];
header.CopyTo(fullData, 0);
img_size.CopyTo(fullData, header.Length);
img.CopyTo(fullData, header.Length + img_size.Length);
拆分:
int[] a = new int[] { 1, 2, 3, 4, 5, 6 };
int[] b = new int[2];
Array.Copy(a, b, b.Length);
int[] c = new int[a.Length - b.Length];
Array.Copy(a, b.Length, c, 0, c.Length);
Debug.Log(b);
Debug.Log(c);