复制并复制两个二维数组 [英] make a clone and copy of two dimentional arrays
本文介绍了复制并复制两个二维数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,如何克隆两个二维数组?如何将两个二维数组复制到另一个数组?在此先感谢
Hello,How can I make a clone of a two dimentional array?How can I copy a two dimentional array to another one? Thanks in advance
推荐答案
第一个Google搜索结果: ^ ]
first google result: http://blog.bee-eee.com/2008/02/12/c-copying-a-2-dimensional-array/[^]
您可以使用克隆 [^ ]方法来获取浅表副本:
You may use Clone[^] method to get a shallow copy:
int[,] a;
a = new int[2, 2];
// initialize a elements here
int[,] b = (int[,]) a.Clone(); // make a copy
int[,] original = new int[2,2] { { 1 ,2 } , { 3, 4 } };
int[,] copy = (int[,]) original.Clone();
问候,
Regards,
这篇关于复制并复制两个二维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文