I have a class, say DerivedBindingList<T>
, which is derived from BindingList<T>
.
I would like to use an indexer with the derived class, and have coded it as:
public T this[int index]
{
get
{
// Getter code
}
set
{
// Setter code
}
}
However, the compiler complains with the following message: "...hides inherited member 'System.Collections.ObjectModel.Collection.this[int]'. Use the new keyword if hiding was intended."
I can add the 'new' keyword and the compiler is happy, but should I be doing things differently in some way to avoid this warning?
Perhaps I have to use base.this[] somehow?
Thanks.