編譯器錯誤 CS0609
更新:2007 年 11 月
錯誤訊息
無法在標記為 override 的索引子上設定 IndexerName 屬性
名稱屬性 (Attribute) (IndexerNameAttribute) 無法套用至覆寫的索引屬性 (Property)。如需詳細資訊,請參閱索引子。
下列範例會產生 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 )
{
}
}