首页 > 编程语言 > 详细

List 排序

时间:2015-07-22 18:00:49      阅读:229      评论:0      收藏:0      [点我收藏+]

1:sort 

List<int> nList= new List<int>(); 
new List<string>(sortStrings).ForEach(e => { nList.Add(int.Parse(e)); });
Item.Sort( (a, b) => { return nList.FindIndex(s => s == a.AttributeId) - nList.FindIndex(s => s == b.AttributeId); });

 

 2:orderby ,OrderByDescending

return list.OrderByDescending(p =>
                {
                    if (true)
                    {
                       return -1;
                    }
                    return 0;
                }).ToList();

 

List 排序

原文:http://www.cnblogs.com/sheseido/p/4667958.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!