I have a SortedList
in my code. I fill inside it key value pairs. When I add an item to SortedList
it sorts automatically by key. But i need to sort it by value. Because the values are visible texts in a combobox. They must be alphabetically sorted. I decided to write a class and inherit from SortedList
class and override the Add
method.
But when I looked at the code of Microsoft's SortedList class, I see there is an Insert
method and it makes the sorting and unfortunately it is private so I cannot override it. Can you help me about this?
Note: I cant use ArrayList
or Dictionary
or something else. I cannot manage all code in our project. I have to return 'SortedList
' or 'MySortedList
' derived from SortedList