LINQ 学习路程 -- 查询操作 ThenBy & ThenByDescending
Posted 蓝平凡
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LINQ 学习路程 -- 查询操作 ThenBy & ThenByDescending相关的知识,希望对你有一定的参考价值。
IList<Student> studentList = new List<Student>() { new Student() { StudentID = 1, StudentName = "John", Age = 18 } , new Student() { StudentID = 2, StudentName = "Steve", Age = 15 } , new Student() { StudentID = 3, StudentName = "Bill", Age = 25 } , new Student() { StudentID = 4, StudentName = "Ram" , Age = 20 } , new Student() { StudentID = 5, StudentName = "Ron" , Age = 19 }, new Student() { StudentID = 6, StudentName = "Ram" , Age = 18 } }; var thenByResult = studentList.OrderBy(s => s.StudentName).ThenBy(s => s.Age); var thenByDescResult = studentList.OrderBy(s => s.StudentName).ThenByDescending(s => s.Age);
以上是关于LINQ 学习路程 -- 查询操作 ThenBy & ThenByDescending的主要内容,如果未能解决你的问题,请参考以下文章