语言基础csharpcs基础 CSharp, CSharp基础 2022-10-31 Source Edit History 2048 用参数改变二维数组(引用数据类型)里的项直接改变原数组 如果是基本数据类型改变参数不会改变原字段 改变原数组 12345678910111213141516public class Test{ static void Main1() { int[,] i = { { 1 } }; int[,] q = TestNum(i); Console.WriteLine(i); } private static int[,] TestNum(int[,] num) { num[0, 0] += 1; return num; }} 不改变原数组 123456789101112131415public class Test{ static void Main() { int i = 1; int q = TestNum(i); Console.WriteLine(i); } private static int TestNum(int num) { num += 1; return num; }}