LINQ 学习路程 -- 查询操作 ThenBy & ThenByDescending
IList<Student> studentList = new List<Student>() {
new Student() { StudentID = , StudentName = "John", Age = } ,
new Student() { StudentID = , StudentName = "Steve", Age = } ,
new Student() { StudentID = , StudentName = "Bill", Age = } ,
new Student() { StudentID = , StudentName = "Ram" , Age = } ,
new Student() { StudentID = , StudentName = "Ron" , Age = },
new Student() { StudentID = , StudentName = "Ram" , Age = }
};
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的更多相关文章
- LINQ 学习路程 -- 查询操作 OrderBy & OrderByDescending
Sorting Operator Description OrderBy 通过给定的字段进行升序 降序 排序 OrderByDescending 通过给定字段进行降序排序,仅在方法查询中使用 Then ...
- LINQ 学习路程 -- 查询操作 Expression Tree
表达式树就像是树形的数据结构,表达式树中的每一个节点都是表达式, 表达式树可以表示一个数学公式如:x<y.x.<.y都是一个表达式,并构成树形的数据结构 表达式树使lambda表达式的结构 ...
- LINQ 学习路程 -- 查询操作 Deferred Execution of LINQ Query 延迟执行
延迟执行是指一个表达式的值延迟获取,知道它的值真正用到. 当你用foreach循环时,表达式才真正的执行. 延迟执行有个最重要的好处:它总是给你最新的数据 实现延迟运行 你可以使用yield关键字实现 ...
- LINQ 学习路程 -- 查询操作 Join
Join操作是将两个集合联合 Joining Operators Usage Join 将两个序列连接并返回结果集 GroupJoin 根据key将两个序列连接返回,像是SQL中的Left Join ...
- LINQ 学习路程 -- 查询操作 where
1.where Filtering Operators Description Where Returns values from the collection based on a predicat ...
- LINQ 学习路程 -- 查询操作 GroupBy ToLookUp
Grouping Operators Description GroupBy GroupBy操作返回根据一些键值进行分组,每组代表IGrouping<TKey,TElement>对象 To ...
- LINQ 学习路程 -- 查询操作 let into关键字
IList<Student> studentList = new List<Student>() { , StudentName = } , , StudentName = } ...
- LINQ 学习路程 -- 查询操作 Aggregate
聚合操作执行数学的运算,如平均数.合计.总数.最大值.最小值 Method Description Aggregate 在集合上执行自定义聚集操作 Average 求平均数 Count 求集合的总数 ...
- LINQ 学习路程 -- 查询操作 Select, SelectMany
IList<Student> studentList = new List<Student>() { , StudentName = "John" }, , ...
随机推荐
- Spring4整合Hibernate5时不能自动生成表结构
© 版权声明:本文为博主原创文章,转载请注明出处 1.问题描述: Spring4整合Hibernate5时,不再使用hibernate.cfg.xml,将其内容整合到Spring配置文件中,启动后不能 ...
- 更改 Nginx 服务的默认用户
为什么要更改 Nginx 服务的默认用户:就像更改 ssh 的默认 22 端口一样,增加安全性,Nginx 服务的默认用户是 nobody ,我们更改为 nginx 1.添加 nginx 用户 use ...
- [转载]Axis2 and CXF的比较
在Celtix 和XFire 宣布合并的同年,另一个著名开源Web 服务框架Axis 的后继者Axis2 也诞生了.Axis2 并非Axis 的2.0 版,而是完全重写了Axis 的新项目.作为功能和 ...
- maven 常用的环境插件
<build> <finalName>yycgproject</finalName> <plugins> <!-- 修改jdk插件 --> ...
- 【Python + selenium】之BSTestRunner:NameError: name 'unicode' is not defined
参考文章:<python3.6 :NameError: name 'unicode' is not defined>
- Idea中优化Markdown Support显示效果
转自:https://www.jianshu.com/p/d093c42a8c29 因为工作中为提高工作效率,我一般习惯于直接在`idea`中使用`markdow support`插件来进行相关文档的 ...
- Lumen开发:结合Redis实现消息队列(3)
4.运行队列监听器 开启任务监听器 Lumen包含了一个Artisan命令用来运行推送到队列的新任务.你可以使用queue:listen命令运行监听器: php artisan queue:liste ...
- Window系统下MongoDB安装及远程访问
1.编辑mongodb 安装文件夹bin\mongod.cfg 把bindIP 改为 127.0.0.1, 192.168.1.180(局域网IP) 可以参考https://blog.csdn.net ...
- POJ1850&&POJ1496
Code Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 9236 Accepted: 4405 Description ...
- hdu 4414 Finding crosses【简单模拟】
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4414 CSUST:点击打开链接 Finding crosses Time Limit: 2000/1000 ...