例:
1 static double a = 10; 2 static double b = 20; 3 4 static void Test(ref double x,out double y) 5 { 6 y = 0; //必须要在方法中赋值一下 7 x *= 10; 8 y *= 20; 9 Console.WriteLine(x); 10 Console.WriteLine(y); 11 } 12 static void Main(string[] args) 13 { 14 Console.WriteLine(a); 15 Console.WriteLine(b); 16 17 Test(ref a,out b); 18 Console.WriteLine(a); 19 Console.WriteLine(b); 20 Console.ReadKey(); 21 }
原文:https://www.cnblogs.com/xt112233/p/9897372.html