本文介绍了如何将2dArray复制到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int [,] 2darray;
int [,] 2dcopy;
int[,] 2darray;
int [,]2dcopy;
推荐答案
int[,] A = {{1,2},{3,4},{5,6}};
int[,] B ;
B = (int[,])A.Clone();
A[0,0] = 99;
A.Dump();
B.Dump();
int[,] a1 = new int[4, 6];
a1[2, 3] = 4;
a1[3, 5] = 25;
int[,] a2 = new int[a1.GetUpperBound(0) + 1, a1.GetUpperBound(1) + 1];
Array.Copy(a1, a2, a1.Length);
public static int[,] copying2dArray(int[,] array, int rowLength, int clumnLength)
{
int[,]Copy = new int[rawLength, columnLenggth];
for (int i = 0; i < rooms; i++)
{
for (int j = 0; j < timeSlots; j++)
{
Copy[i, j] = aray[i, j];
}
}
return populationCopy;
}
这篇关于如何将2dArray复制到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!