解决方案 »

  1.   

    List<byte> a;
    二维数组循环添加到a中
    byte[] = a.ToArray()
    这个效率较差 二维数组很少用
      

  2.   

      public static IEnumerable<T> ToEnumerable<T>(this Array target)
            {
                foreach (var item in target)
                    yield return (T)item;
            }test:
      int[,] aa = new int[2, 2] {{1, 2}, {1, 2}};
                int[,,] aaa = new int[2,2,2] {{{1,2},{1,2}}, {{1,2},{1,2}}};            var enumerable = from i in aaa.ToEnumerable<int>()
                    select i;
                foreach (var i in enumerable)
                {
                    Console.WriteLine(i);
                }            foreach (var i in aaa)
                {
                    Console.WriteLine(i);
                }
                Console.Clear();
               Console.WriteLine(aaa[1,0,0]);
      

  3.   

    byte[] result = new byte[data.GetLength(0) * data.GetLength(1)];
    for (int i = 0; i < result.GetLength(0); i++)
    {
        result[i] = data[i / data.GetLength(1), i % data.GetLength(1)];
    }
      

  4.   

    这个写循环就可以解决了,先计算总长度,然后 new 一下,再复制,感觉没有什么技巧可用。
      

  5.   

    如果是交错数组,可以用linq:
    byte[] result = data.SelecMany(x => x).ToArray();