using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 引用传递 { class Program { static void fun(ref int x, ref int y) { x = x + 1; y = y - 1; } static void Main(string[] args) { int m = 3; int n = 4; Console.WriteLine("调用前m = {0}, n = {1}",m,n); fun(ref m, ref n); Console.WriteLine("调用后m = {0}, n = {1}",m,n); Console.ReadKey(); } } }