更新:2007 年 11 月
错误消息
ref 或 out 参数必须是可以赋值的变量
在方法调用中只有一个变量可以作为 ref 参数传递。ref 值与传递指针类似。
示例
下面的示例生成 CS1510:
// CS1510.cs
public class C
{
   public static int j = 0;
   public static void M(ref int j)
   {
      j++;
   }
   public static void Main ()
   {
      M (ref 2);   // CS1510, can't pass a number as a ref parameter
      // try the following to resolve the error
      // M (ref j);
   }
}