编译器错误 CS1551
更新:2007 年 11 月
错误消息
索引器必须至少有一个参数
声明的索引器不带参数。
下面的示例生成 CS1551:
// CS1551.cs
public class MyClass
{
int intI;
int this[] // CS1551
// try the following line instead
// int this[int i]
{
get
{
return intI;
}
set
{
intI = value;
}
}
public static void Main()
{
}
}