Click here to Skip to main content
15,916,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ArrayList availableTags = new ArrayList();

The available tags contains the values are

2016 - 2015 (09 - September)
2016 - 2015 (07 - July)
2016 - 2015 (05 - May)
2016 - 2015 (03 - March)
2016 - 2015 (01 - January)
2015 - 2014 (11 - November)
2015 - 2014 (12 - December)
2016 - 2015 (02 - February)
2016 - 2015 (04 - April)
2016 - 2015 (06 - June)
2016 - 2015 (08 - August)
2016 - 2015 (10 - October)


How to sort in descending order?

What I have tried:

sort in descending the array list values
Posted
Updated 26-Oct-16 20:22pm

1 solution

The easiest way can be to sort them (ascending) and then revese them.
ArrayList.Sort Method (System.Collections)[^] and ArrayList.Reverse Method (System.Collections)[^] can help you in this regard.

Something like following should help -
C#
availableTags.Sort();
availableTags.Reverse();


Reference: https://www.dotnetperls.com/arraylist[^]

Hope, it helps :)
 
Share this answer
 
Comments
Karthik_Mahalingam 28-Oct-16 8:15am    
5,btw congrats for 50k

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900