SorteList Comparer: how to change it on the fly?

  • Thread starter Thread starter tommaso.gastaldi
  • Start date Start date
T

tommaso.gastaldi

Hi, I need to change at runtime the Comparer of a SortedList of mine
(it does not seem to expose a Comparer or Icomparer property).

Do you know how can I do that (clearly without reconstructing the SL) ?

Thanks

-Tom
 
Only way I can see is by either creating a new one (using the contstructor
that takes an IDictionary and an IComparer) or somehow change the
IComparable implementation of the keys

/claes
 
Thank you Claes, I will go the second way you suggest.

Once I change the implementation, I may need to force
a reordering of the existing list, for compare purpose - before
adding or removing any item (which would force the reorder) -
Can you see a meaningful way to force the reordering ?

-Tommaso

Claes Bergefall ha scritto:
 
Back
Top