如何按降序对数组列表值进行排序 [英] How to sort the array list values in descending order
问题描述
ArrayList availableTags = new ArrayList();
可用标签包含的值是
2016年 - 2015年(09 - 9月)
2016年 - 2015年(2015年7月7日)
2016年 - 2015年(05年5月5日)
2016年
- 2015年(03年3月至3月)
2016年 - 2015年(1 - 1月)
2015年 - 2014年(11 - 11月)
2015年至2014年
( 12 - 12月)
2016 - 2015(02 - 2月)
2016 - 2015(04 - 4月)
2016 - 2015(06 - 6月)
2016 - 2015(08 - 8月)
2016 - 2015(10 - 10月)
如何按降序排序?
我尝试过:
按数组列表值降序排序
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
推荐答案
最简单的方法是对它们进行排序(升序)然后再发现它们。 br />
ArrayList.Sort方法(System.Collections) ) [ ^ ]和 ArrayList.Reverse方法(System.Collections) [ ^ ]在这方面可以帮到你。
以下内容应该有所帮助 -
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 -
availableTags.Sort();
availableTags.Reverse();
参考: https://www.dotnetperls.com/arraylist [ ^ ]
希望,它有帮助:)
Reference: https://www.dotnetperls.com/arraylist[^]
Hope, it helps :)
这篇关于如何按降序对数组列表值进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!