当前位置:网站首页>LINQ 查询
LINQ 查询
2022-06-23 00:35:00 【flysh05】
1. Linq 查询
语法:
var QueryResults= from x in 枚举集合
where 条件
OrderBy 字段 Ascending/Descending
Select x;
扩展方法:
var QueryResults= 枚举集合.Where(条件)
.OderByDescending(条件)
.Select(字段);
筛选符合条件的数据,常用Linq语法或扩展方法。
2.推迟查询
var names = new List { “Nino”, “Alberto”, “Juan”, “Mike”, “Phil” };
var namesWithJ = from n in names
where n.StartsWith(“J”)
orderby n
select n;
WriteLine(“First iteration”);
foreach (string name in namesWithJ)
{
WriteLine(name);
}
WriteLine();
names.Add(“John”);
names.Add(“Jim”);
names.Add(“Jack”);
names.Add(“Denny”);
WriteLine(“Second iteration”);
foreach (string name in namesWithJ)
{
WriteLine(name);
}
WriteLine();
两次迭代之间输出保持不变,但集合中的值改变了。
边栏推荐
- Notes on zhouguohua's reading
- RedisTemplate使用遇到\x00的問題
- Ansible 学习总结(8)—— Ansible 控制提权相关知识总结
- 【滑动窗口】leetcode992. Subarrays with K Different Integers
- Hello, is the securities account presented by the Business School of qiniu business school safe? How can I open a safe stock account to speculate in stocks
- flowable 全局监听 监听流程的启动和流程的结束
- How about China International Futures Co., Ltd.? Is it a regular futures company? Is it safe to open an account online?
- How to use swagger2
- KunlunDB查询优化(三)排序下推
- #yyds干货盘点#尾递归比递归好在哪儿
猜你喜欢

SAP UI5 应用开发教程之一百零三 - 如何在 SAP UI5 应用中消费第三方库

Optimization - linear programming

OpenCvSharp (C# OpenCV) 微信QRCode解码功能使用介绍(附源码)

初学者如何快速入门深度学习?

KunlunDB查询优化(三)排序下推

Typecho仿卢松松博客主题模板/科技资讯博客主题模板

EasyCVR使用RTMP推流时不显示界面如何解决?

Oracle ASM uses the CP command in asmcmd to perform remote replication

To establish a cloud computing "Kunlun", why should Lenovo hybrid cloud Lenovo xcloud?

Typecho imite le modèle de thème du blog Lu songsongsong / modèle de thème du blog d'information technologique
随机推荐
JSBridge
Kunlundb query optimization (I)
瑞达期货安全么?期货开户都是哪些流程?期货手续费怎么降低?
Notes on zhouguohua's reading
打新债属于什么理财产品?
How to use enum data types
美团基于 Flink 的实时数仓平台建设新进展
[go] go language interface
Typecho imite le modèle de thème du blog Lu songsongsong / modèle de thème du blog d'information technologique
Some thoughts about the technology of test / development programmers are very advanced, and they can't go on
KunlunDB备份和恢复
数据库每日一题---第20天:按日期分组销售产品
Typecho仿盧松松博客主題模板/科技資訊博客主題模板
在一条DML语句中插入/更新/删除/获取几百万行数据,你会特别注意什么?
工程目录导航
你踩过这些坑吗?谨慎在时间类型列上创建索引
Ecmascript6 new features
【PHP】php多态
Typecho imitation of Lu Songsong's blog theme template / Technology Information blog theme template
Kunlundb query optimization (III) sort push down