using
System;
class Method // 数组是引用类型的,作为方法参数时,值会被方法体改变
... {
static void PrintArr(int[] arr)
...{
for (int i = 0; i < arr.Length; i++)
...{ arr[i] = i; }
}
static void Main()
...{
int[] arr1 =...{ 100, 200, 300, 400 };
PrintArr(arr1);
foreach (int i in arr1)
...{ Console.Write(i + ", "); }
}
}
class Method // 数组是引用类型的,作为方法参数时,值会被方法体改变
... {
static void PrintArr(int[] arr)
...{
for (int i = 0; i < arr.Length; i++)
...{ arr[i] = i; }
}
static void Main()
...{
int[] arr1 =...{ 100, 200, 300, 400 };
PrintArr(arr1);
foreach (int i in arr1)
...{ Console.Write(i + ", "); }
}
}