111,094
社区成员




List<byte[]> array = new List<byte[]>
{
new byte[]{1,2,3,4 },
new byte[]{5,6,7,8},
new byte[]{9,10}
};
var result = array.Aggregate(new List<byte>(), (s, x) =>
{
s.AddRange(x);
return s;
});
搞懂这里的深一层的算法更重要,不要抄皮毛。 int o = 0;
foreach (byte[] x in array)
{
Array.Copy(x, 0, totalBytes, o, x.Length);
o += x.Length;
}
int index = 0;
foreach (byte[] item in array)
{
foreach (byte byValue in item)
{
totalBytes[index++] = byValue;
}
}
array.CopyTo(totalBytes, 0);