I'm trying to rename my indexer property using IndexerName attribute on my abstract classes. But it still show compilation error The type 'XXX' already contains a definition for 'Item'.
Abstract class:
public abstract class MyAbstract
{
[IndexerName("Indexer")]
public abstract string this[string propertyName]
{
get;
}
}
Concrete class:
public class MyConcrete : MyAbstract
{
string item;
public string Item
{
get { return item; }
set { item = value; }
}
public override string this[string propertyName]
{
get { return propertyName; }
}
}
Compilation error:
The type 'MyConcrete' already contains a definition for 'Item'.
I've tried to put IndexerName on indexer override and it show error "Cannot set the IndexerName attribute on an indexer marked override"
How to use IndexerName on abstract classes ?
Thanks in advance.