Compiler Error CS0609
Cannot set the IndexerName attribute on an indexer marked override
The name attribute (IndexerNameAttribute) cannot be applied to an indexed property that is an override. For more information, see Indexers.
The following sample generates 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)
{
}
}
Note
This compiler error is no longer used in Roslyn. The previous code should compile successfully.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: