|
-
Sep 22nd, 2008, 12:41 AM
#1
Thread Starter
Addicted Member
How can I use "Sorted List" on my object collection
Hello,
I need help to sort the collection.
Controller is returning me the collection of data. Before I bind to repeater control I would like to sort it. I thought of using Sorted List. But I need to know how can I use it in better way.
Code:
List<CurrentServices> currentCollection;
currentCollection = CurrentInfoController.GetServices();
I want to sort currentCollection now.
Kinldy let me know.
Many Thanks
-
Sep 22nd, 2008, 01:41 AM
#2
Re: How can I use "Sorted List" on my object collection
-
Sep 22nd, 2008, 03:09 AM
#3
Thread Starter
Addicted Member
Re: How can I use "Sorted List" on my object collection
Thanks harsh,
I will try it..
 Originally Posted by Harsh Gupta
-
Sep 23rd, 2008, 12:18 AM
#4
Thread Starter
Addicted Member
Re: How can I use "Sorted List" on my object collection
Code:
ServiceCollection.Sort(delegate(Service informationOne, Service informationTwo)
{
return informationOne.DisplayName.CompareTo(informationTwo.DisplayName);
});
this is working for me. internally how it works is my question?
anybody?
 Originally Posted by CodeMaker
Thanks harsh,
I will try it..
-
Sep 24th, 2008, 03:48 AM
#5
Re: How can I use "Sorted List" on my object collection
You could use ILDASM to look at what it's doing internally but the basic mechanism is that the Sort method iterates through all of the items in the List, passing two items at a time as per the QuickSort algorithm.
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
|