Ошибка компилятора CS0609
Обновлен: Ноябрь 2007
Сообщение об ошибке
Невозможно назначить атрибут IndexerName для индексатора, помеченного как override
Cannot set the IndexerName attribute on an indexer marked override
Атрибут имени (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 )
{
}
}