NetBlog主题

C# List集合根据对象某个字段排序
C#基础

C# List集合根据对象某个字段排序

2119 0

public class Student{public string name;public int num;}ListStudent students=new ListStudent();//假设students集合里面添加了数据ListStudent temp1= students.OrderBy(s = s.num).ToList();//num 小大到ListStudent temp2= students.OrderByDescending(…