【发布时间】:2014-04-23 17:15:24
【问题描述】:
我有一个 Person 对象的集合,而 Person 对象有一个 id 属性。
var peopleList = new List<Person>();
peopleList .Add(new Person(){Name = Joe, Id = 30};
peopleList .Add(new Person(){Name = Tom, Id = 22};
peopleList .Add(new Person(){Name = Jack, Id = 62};
我现在有一个整数数组,表示我想要显示数组的顺序
var list = new List<int>();
list.Add(22);
list.Add(62);
list.Add(30);
按 List 数组对 PeopleList 集合进行排序的正确方法是什么?所以我得到了一个订单:
Tom, Jack, Joe
【问题讨论】:
标签: c# sorting collections