Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fastest way to sort a collection
Message
From
30/01/2013 18:40:34
 
 
To
30/01/2013 17:56:29
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01564757
Message ID:
01564768
Views:
44
If you know your collection is in ascending order and you want it descending, just reverse it (http://msdn.microsoft.com/en-us/library/b0axc2h2%28v=vs.90%29.aspx). Otherwise you can use the sort method (http://msdn.microsoft.com/en-us/library/3da4abas%28v=vs.90%29.aspx) to sort it, although you might need to create your own comparer. Or you could change your collection to a SortedList (http://msdn.microsoft.com/en-us/library/ms132319%28v=vs.90%29.aspx) so that the list is created in a sorted order.

It might also help to know exactly what type of collection you are using, how you are sorting now that is too slow, and why your collection is composed of single element object arrays instead of strings.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform