zoukankan
html css js c++ java
Linq 演变的过程(delegate => Lamb => Linq)
演变的过程(
delegate
=>
Lamb
=>
Linq)
1
.
Func
<
string
,
bool
>
filter
=
delegate
(
string
s)
{
return
s.Length
==
5
;}
;
Func
<
string
,
string
>
extract
=
delegate
(
string
s)
{
return
s;}
Func
<
string
,
string
>
project
=
delegate
(
string
s)
{
return
s.ToUpper();}
IEnumerable
<
string
>
query
=
names
.where(filter)
.orderby(extract)
.select(project);
2
.
IEnumerable
<
string
>
query
=
names
.where(s
=>
s.Length
==
5
)
.orderby(s
=>
s)
.select(s
=>
s.ToUpper())
3
.
IEnumerable
<
string
>
query
=
from s
in
names
where s.Length
==
5
orderby s
select s.ToUpper();
了解了代码的演变,有助于对linq有一个初步认识.
查看全文
相关阅读:
【09】绝不在构造和析构过程中调用virtual方法
【08】别让异常逃离析构函数
C++ 外部调用private方法
【07】为多态基类声明virtual析构方法
C++ 构造过程和析构过程
理解C# Lazy<T>
DG
MongoDB
sh.status()
DG
原文地址:https://www.cnblogs.com/RuiLei/p/784852.html
最新文章
代码实现:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子, * 小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子对数为多少? 程序分析: 兔子的规律为数列1,1,2,3,5,8,13,21....
代码实现:输出下列的形状-直角三角形
代码实现:输出一个4行5列的星星(*)图案。
代码实现:在控制台输出所有的”水仙花数”
继成极光推送SDk的实现
Fragment 的 replace 和 add 方法的区别?
架构师速成6.9-怎样写好代码
面试题:使用finalkeyword修饰一个变量时,是引用不能变,还是引用的对象不能变?
wait和notify实现的生产者消费者线程交互
mpeg文件格式分析
热门文章
PL/SQL Developer 和 instantclient客户端安装配置
c++ 字符串常量
android历史
HDU 1272 小希的迷宫
hdu3076--ssworld VS DDD(概率dp第三弹,求概率)
[LeetCode] Summary Ranges
【25】考虑写出一个不抛异常的swap函数
理解shared_ptr<T> ---2
理解shared_ptr<T>
理解 auto_ptr<T>
Copyright © 2011-2022 走看看