更新:2007 年 11 月
错误消息
ref 和 out 参数在此上下文中无效
indexer 的声明不能包括对 ref 或 out 参数的使用。
示例
下面的示例生成 CS0631:
// CS0631.cs
public class MyClass
{
public int this[ref int i] // CS0631
// try the following line instead
// public int this[int i]
{
get
{
return 0;
}
}
}
public class MyClass2
{
public static void Main()
{
}
}