编译器错误 CS0206
更新:2007 年 11 月
错误消息
属性或索引器不得作为 out 或 ref 参数传递
属性不可作为 ref 或 out 参数传递。有关更多信息,请参见传递参数(C# 编程指南)。
示例
下面的示例生成 CS0206:
// CS0206.cs
public class MyClass
{
public static int P
{
get
{
return 0;
}
set
{
}
}
public static void MyMeth(ref int i)
// public static void MyMeth(int i)
{
}
public static void Main()
{
MyMeth(ref P); // CS0206
// try the following line instead
// MyMeth(P); // CS0206
}
}