|
-
Oct 10th, 2007, 04:36 PM
#1
Thread Starter
Hyperactive Member
Descending Sorted List
How can I have a Sorted List in Descending Order?
-
Oct 10th, 2007, 05:04 PM
#2
Re: Descending Sorted List
-
Oct 10th, 2007, 06:26 PM
#3
Re: Descending Sorted List
Firstly, let me point out what you should have done up to now. To start with, you should have checked the appropriate radio button when creating this thread so we know what version you're using. If you're using 1.x then we know that it's a regular SortedList. If it's 2.0 then we would assume that it's a generic SortedList (i.e. SortedList<TKey, TValue>), although you really should specify because you can use either.
Before that though, you should have read the documentation for the class you're using. Assuming you are using a regular SortedList you would then have read this:
The elements of a SortedList are sorted by the keys either according to a specific IComparer implementation specified when the SortedList is created or according to the IComparable implementation provided by the keys themselves. In either case, a SortedList does not allow duplicate keys.
You now know that if you want to use other than default sorting you have to provide an IComparer when the collection is created. That means when invoking a constructor, so you should then have read the documentation for the SortedList constructor. That would give you descriptions and examples of providing an IComparer to sort the keys.
You should have done all that already as a matter of course. You may still not know exactly how to declare the IComparer, but you should already know that that's what you need to do. The Help is there to help so you should ALWAYS read it first when you have a question.
Now, I'm quite prepared to provide a code example for you but not until you specify whether you're using a regular SortedList or the generic variety.
-
Oct 12th, 2007, 04:10 PM
#4
Thread Starter
Hyperactive Member
Re: Descending Sorted List
Thanks.
jmcilhinney, you are right, I should have done my homework.
I am using the regular Sorted List.
This did the trick for me.
http://www.skystonesoftware.com/temp...E-6C84E2F71E22
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|