To elaborate on Jon's reply: Create a new class that does not *inherit*
SortedList, but *contains* a SortedList instance in it. You can expose the
attributes of SortedList via the new class, and not expose those which you
want to hide.
In addition, you may want to implement some of the interfaces that
SortedList implements, for a variety of reasons.
I recently had a similar problem when creating a Generic HistoryList
Collection. There is no such Collection in the Framework. A HistoryList is a
Collection which has a limited capacity, and can grow to that capacity, but
no larger. When it reaches Capacity, it removes items from the beginning of
the list to make room for new ones. In addition, it has a Position, which
indicates the current Position in the list, to allow for both undoing and
redoing. One can move the Position backwards and forwards in the list. When
one adds an item at a Position which is not the end, all items from that
point forward are removed.
I looked at a number of different Generic Lists, Collections, and
Interfaces, and determined that the Generic List was my best place to start.
I created the List as a protected member, and exposed the method, properties
etc., which were relevant while hiding others. I then added methods,
properties, etc., which provided the "HistoryList-specific" functionality
required. I also implemented the IEnumerable, ICollection, and IList
interfaces, to make it useful in a variety of situations which require
interfaces.
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Show me your certification without works,
and I'll show my certification
*by* my works.