C
Clive Dixon
Is it possible to access an indexer of a base class with identical
signature, e.g.
class Class1
{
public object this[object o]
{
get
{
// ...
}
}
}
class Class2 : Class1
{
public new object this[object o]
{
get
{
return base.this[o];
}
}
}
The compiler will not accept 'base.this' nor 'base.Item'/'base.get_Item' and
I can't find any reference to calling base class indexers anywhere in the
documentation. Now if the base class indexer has a different signature I can
simply use 'this' rather than 'base.this' and cast the indexer parameter to
that of the base class's indexer to force calling the correct base class
indexer, but if the signatures are identical I cannot see how to call the
base class indexer.
signature, e.g.
class Class1
{
public object this[object o]
{
get
{
// ...
}
}
}
class Class2 : Class1
{
public new object this[object o]
{
get
{
return base.this[o];
}
}
}
The compiler will not accept 'base.this' nor 'base.Item'/'base.get_Item' and
I can't find any reference to calling base class indexers anywhere in the
documentation. Now if the base class indexer has a different signature I can
simply use 'this' rather than 'base.this' and cast the indexer parameter to
that of the base class's indexer to force calling the correct base class
indexer, but if the signatures are identical I cannot see how to call the
base class indexer.