参数是一个拷贝

class Program
  {
    static void Main(string[] args)
    {
      string a = "abc";
      string b = "bcd";
      method(a,b);
      Console.WriteLine("a:" + a + "b:" + b);
    }
    static void method(string a, string b)
    {
      string temp = a;
      a = b;
      b = temp;
      Console.WriteLine("a:" + a + "b:" + b);
    }
}

结果:

原文地址:https://www.cnblogs.com/wouldguan/p/2512358.html