Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fastest way to sort a collection
Message
De
30/01/2013 18:40:34
 
 
À
30/01/2013 17:56:29
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01564757
Message ID:
01564768
Vues:
45
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform