降序排列 [英] sort in descending order

查看:96
本文介绍了降序排列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何按降序对列表框内的整数排序?

谢谢.

How do you sort integer inside a listbox in desceding order?

thanks.

推荐答案

不要对此类控件中的任何内容进行排序.将数据存放在适当的集合中,然后使用说"(或使其始终像在System.Collections.Generic.SortedListSystem.Collections.Generic.SortedDictionary中那样始终进行排序)之类的方式对数据进行排序,然后使用数据填充或绑定该控件.

由于您需要在排序中使用自定义顺序,请使用以下命令:
http://msdn.microsoft.com/en-us/library/w56d4y5z.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/234b841s.aspx [ ^ ].

上面引用的帮助MSDN文章中提供了代码示例.

—SA
Don''t sort anything in controls like this. Have your data in some suitable collection and sort your data first like in System.Collections.Generic.List<int>.Sort(), using, say (or keep it always sorted like in System.Collections.Generic.SortedList, System.Collections.Generic.SortedDictionary) and then populate the control with data or bind it.

As you need to use custom order in sorting, use this:
http://msdn.microsoft.com/en-us/library/w56d4y5z.aspx[^],
http://msdn.microsoft.com/en-us/library/234b841s.aspx[^].

Code samples are available in the help MSDN articles referenced above.

—SA


这篇关于降序排列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆