编译器错误 CS0609
更新:2007 年 11 月
错误消息
不能在标记为 override 的索引器上设置 IndexerName 属性
名称特性 (IndexerNameAttribute) 不能应用于本身为重写的索引属性。有关更多信息,请参见索引器。
下面的示例生成 CS0609:
// CS0609.cs
using System;
using System.Runtime.CompilerServices;
public class idx
{
public virtual int this[int iPropIndex]
{
get
{
return 0;
}
set
{
}
}
}
public class MonthDays : idx
{
[IndexerName("MonthInfoIndexer")] // CS0609, delete to resolve this CS0609
public override int this[int iPropIndex]
{
get
{
return 0;
}
set
{
}
}
}
public class test
{
public static void Main( string[] args )
{
}
}