C# LINQ 详解 From Where Select
2018-03-16 10:34
603 查看
整理一个小例子 加深记忆
// 1,获取数据源
List<int> numbers = new List<int>() { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
// 2,创建查询
var numQuery = from num in numbers
where num % 2 == 0
select num;
// 3,执行查询
foreach (var num in numQuery)
{
Console.WriteLine("{0,1}", num);
}
// 1,获取数据源
List<int> numbers = new List<int>() { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
// 2,创建查询
var numQuery = from num in numbers
where num % 2 == 0
select num;
// 3,执行查询
foreach (var num in numQuery)
{
Console.WriteLine("{0,1}", num);
}
相关文章推荐
- C#: from in select ; m(linq where)
- Linq之详解 From Where Select Group Into OrderBy Let Join
- C# Array 中的 Linq 方法 Where Count Select
- LINQ中in的实现方法-LINQ To Entities如何实现查询 select * from tableA where id in (1,2,3,4)
- LINQ To Entities如何实现查询 select * from tableA where id in (1,2,3,4) ?
- c# from where select
- select from where 格式详解
- SQL查找表指定部分,where后条件不确定:select * from table where 1='1';
- discuz搬家后报错SQL:SELECT value FROM [Table]vars WHERE name=’noteexists1′的解决办法
- select * from table WHERE 日期字段名 BETWEEN '起始日期' AND '结束日期'
- mysql之select from where
- SQL查询语句中select from where group by having order by的执行顺序
- UPDATE {0} SET DisplayOrder=(SELECT COUNT(1) FROM {0} b WHERE b.DisplayOrder<a.DisplayOrder AND {1})
- select from table where 1=1
- select name from syscolumns where id=object_id(\'表名\')
- [深入学习C#]LINQ查询表达式详解(2)——查询表达式的转换
- Linq:基本语法form ,select, where(2)
- select into from与insert into select区别详解,sql语句复制表
- C#之Linq、where()、FindAll()的区别
- select * from (select P.*,ROWNUM RN FROM(select * from Mp_Relatedart where pubbaseid=785 order by ID ASC )P)M WHERE M.RN>2 and M.RN <= 7