C# 引用类型参数 ref
1、特点:传参会改变原值
2、格式:(ref int x, ref int y)
static void Main(string[] args) { int a = 10; int b = 20; Add(ref a, ref b); Console.WriteLine("A:{0}", a); Console.WriteLine("B:{0}", b); } static void Add(ref int x, ref int y) { x++; y--; Console.WriteLine("X:{0}", x); Console.WriteLine("Y:{0}", y); }