class Program
{
static void Main()
{
int[] it = new int[10];
for (int i = 0; i < it.Length; i++)
{
Console.WriteLine(it[i]);
}
int[] oldim = new int[it.Length];
Array.Copy(it, oldim, it.Length);//对原始数组的浅拷贝,返回对新数组的引用。
test(oldim);//000000。。
test(it);//123456.。。
for (int i = 0; i < it.Length; i++)
{
Console.WriteLine(it[i]);
}
//int[] ildim = new int[5];
Console.ReadKey();
}
static void test(int[] i)
{
for (int n = 0; n < i.Length; n++)
{
i[n] = n;
}
}
}
转载于:https://www.cnblogs.com/smailxiaobai/archive/2011/12/21/2295800.html