如何对具有多个参数的列表进行排序? [英] How to Sort a list with multiple parameter?
本文介绍了如何对具有多个参数的列表进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用多个参数对列表进行排序
How to sort a list with multiple parameter
推荐答案
如果您使用的是列表< t>您可以使用内置的Sort方法.
看看此页面上的信息[ ^ ].
另请阅读此页面 [
If you are using a List<t> you can use the built in Sort method.
Take a look at the information on this page[^].
Also read this page[^].
尝试一下..
http://stackoverflow.com/questions/1421322/how-do-i-sort-a-list-with-multiple-sort-parameters [对多个字段上的对象进行排序 [使用LINQ对多个值进行排序 [
try from this..
http://stackoverflow.com/questions/1421322/how-do-i-sort-a-list-with-multiple-sort-parameters[^]
Sorting with Objects on Multiple Fields[^]
Sort on multiple values with LINQ[^]
selectedOrderDetails.Sort(delegate(OrderProcessing.OrderSchema order, OrderProcessing.OrderSchema comparerOrder) { return CompareTo(comparerOrder.OrderDate) != 0 ? order.OrderDate.CompareTo(comparerOrder.OrderDate) : order.ChannelOrderRefNumeric.CompareTo(comparerOrder.ChannelOrderRefNumeric); });
}
I am using like this to sort a list with multiple parameter using conditional operator..
but i didn't use Linq , Icampare...
is single line code to sort.......
这篇关于如何对具有多个参数的列表进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文