如何实现二维数组之间复制?

解决方案 »

  1.   

    行与列分别FOR循环结构实现单元复制.
      

  2.   

     int[,] ai= {{1,1},{2,2}};
                int[,] b = new int[2,2];
                Array.Copy(ai, b, 4);
      

  3.   

            int[,] ai = { { 1, 1 }, { 2, 2 },{3,3},{4,4} };
            int[,] b = new int[2, 2];
            int[,] c = new int[2, 2];
            this.Response.Write(System.DateTime.Now.ToString()+"<br>");
            b = ai;
            this.Response.Write(System.DateTime.Now.ToString() + "<br>");        foreach (int bb in b)
            this.Response.Write(bb.ToString() + "</br>");        this.Response.Write(System.DateTime.Now.ToString() + "<br>");
            Array.Copy(ai, c, 4);
            this.Response.Write(System.DateTime.Now.ToString() + "<br>");