如何对列表进行排序?
persons.OrderBy(p => p.rate).ToList();
Run Code Online (Sandbox Code Playgroud)
list(persons)的列表声明如下:
public class Persons : List<Person> { }
Run Code Online (Sandbox Code Playgroud)
当我试图运行第一个语句时,我收到一个错误:
无法从'System.Collections.Generic.List'转换为'Persons'
有没有办法用LINQ做到这一点?