我现在是这么合并的 ,感觉很差 byte[] a ;
byte[] b ;
byte[] c = new byte[] { Convert.ToByte(a.Length + b.Length) }; byte[] d = new byte[c.Length + a.Length + b.Length];
int pos = 0;
Buffer.BlockCopy(c, 0, d, 0, c.Length);
pos += c.Length;
Buffer.BlockCopy(a, 0, d, pos, a.Length);
pos += a.Length; Buffer.BlockCopy(b, 0, d, pos, b.Length);
byte[] b={5,6,7,8};
byte[] c = new byte[] { Convert.ToByte(a.Length + b.Length) }; byte[] d = a.Concat(b).Concat(c).ToArray();
“System.Array”不包含“Concat”的定义,并且找不到可接受类型为“System.Array”的第一个参数的扩展方法“Concat”(是否缺少 using 指令或程序集引用?)
byte[] b = { 5, 6, 7, 8 };
List<byte> c = new List<byte>(a);
c.AddRange(b);
return c.ToArray();