Re: Sorting lists in .Net - why it sucks
- From: "Marc Gravell" <marc.gravell@xxxxxxxxx>
- Date: Fri, 25 Jan 2008 15:38:26 -0000
When you're done with the venom, this is clearly documented:
http://msdn2.microsoft.com/en-us/library/ms132319.aspx
"Every key in a SortedList<(Of <(TKey, TValue>)>) must be unique."
(equally, the exception tells you very clearly what the problem is)
With regards to unstable sort, this too is clearly documented:
http://msdn2.microsoft.com/en-us/library/b0zbh7b6.aspx
"This implementation performs an unstable sort; that is, if two
elements are equal, their order might not be preserved."
I might be mistaken but I seem to recall that the LINQ sort is stable.
Likewise in like there is an ILookup<TKey,TValue> for duplicated keys,
but the default implementation (Lookup<TKey, TValue>) is immutable. It
took me only a few moments to write a mutable ILookup<TKey, TValue>
implementation, however.
Marc
.
- References:
- Sorting lists in .Net - why it sucks
- From: nightwatch77
- Sorting lists in .Net - why it sucks
- Prev by Date: Re: Properties vs. Fields
- Next by Date: Re: Properties vs. Fields
- Previous by thread: RE: Sorting lists in .Net - why it sucks
- Next by thread: Re: Sorting lists in .Net - why it sucks
- Index(es):
Loading