C# 3.0通过Linq、Lambda、匿名函数、代理函数实现数据查询
这几天,正在学习Linq、Lambda,做了些实验,通过Linq、Lambda、匿名函数、代理函数4种方式实现一个简单的查询,把实现结果记录一下,以免忘记。
这段代码中有一个Person类,包含Name和Age两个属性。
还有一个PersonHelper类(这个类规划不是很合理,只是做实验用下),包含一个强类型的List<Person>,并提供了4种实现数据查询的方法(都是查询年龄大于5的人员信息,并返回):
下面是完整的代码(VSTS 2008,基于 .Net 3.0 的控制台工程)
Name is : Jiessieliang6 , Age is : 6
Name is : Jiessieliang6 , Age is : 6
Name is : Jiessieliang6 , Age is : 6
Name is : Jiessieliang6 , Age is : 6
同一个查询,可以通过Linq,Lambda表达式,匿名方法和代理来实现。
这段代码中有一个Person类,包含Name和Age两个属性。
还有一个PersonHelper类(这个类规划不是很合理,只是做实验用下),包含一个强类型的List<Person>,并提供了4种实现数据查询的方法(都是查询年龄大于5的人员信息,并返回):
//方法1:通过Linq返回大于某个年龄段的人
public IEnumerable<Person> GetPersonByLinq(int age)
//方法2:通过Lambda表达式返回大于某个年龄段的人
public IEnumerable<Person> GetPersonByLambda(int age)
//方法3:通过匿名函数返回大于某个年龄段的人
public IEnumerable<Person> GetPersonByAnonymouseMethod(int age)
//方法4:通过代理函数返回大于某个年龄段的人(由于代理函数传递年龄参数不方便,代理函数是通过外部函数完成的)
public IEnumerable<Person> GetPersonBydelegate(Func<Person,bool> func)
public IEnumerable<Person> GetPersonByLinq(int age)
//方法2:通过Lambda表达式返回大于某个年龄段的人
public IEnumerable<Person> GetPersonByLambda(int age)
//方法3:通过匿名函数返回大于某个年龄段的人
public IEnumerable<Person> GetPersonByAnonymouseMethod(int age)
//方法4:通过代理函数返回大于某个年龄段的人(由于代理函数传递年龄参数不方便,代理函数是通过外部函数完成的)
public IEnumerable<Person> GetPersonBydelegate(Func<Person,bool> func)
下面是完整的代码(VSTS 2008,基于 .Net 3.0 的控制台工程)
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
namespace LinqTest
7
{
8
class Program
9
{
10
static void Main(string[] args)
11
{
12![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
13
PersonHelper helper = new PersonHelper();
14![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
15
//初始化Person类(0-6岁),并把结果放入list列表
16
for (int i = 0; i < 7; i++)
17
{
18
Person p = new Person()
19
{ Name = string.Format("Jiessieliang{0}", i.ToString()), Age = i };
20![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
21
helper.List.Add(p);
22
}
23![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
24
//方法1:通过Linq返回岁数大于5的人员集合
25
IEnumerable<Person> results = helper.GetPersonByLinq(5);
26
Print(results);
27![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
28![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
29
//方法2:通过Lambda表达式返回岁数大于5的人员集合
30
IEnumerable<Person> results1 = helper.GetPersonByLambda(5);
31
Print(results1);
32![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
33![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
34![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
35
//方法3:通过匿名方法返回岁数大于5的人员集合
36
IEnumerable<Person> results2 = helper.GetPersonByAnonymouseMethod (5);
37
Print(results2);
38![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
39![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
40
//方法4:通过代理函数返回岁数大于5的人员集合
41![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
42
//定义一个代理【protected static bool getByAge(Person person)】
43
Func<Person, bool> func = new Func<Person, bool>(getByAge);
44![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
45
//通过代理函数返回岁数大于5的人员集合
46
IEnumerable<Person> results3 = helper.GetPersonBydelegate(func);
47
Print(results3);
48![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
49![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
50
Console.Read();
51
}
52![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
53
/// <summary>
54
/// 方法4中 最终被调用执行的代理函数
55
/// </summary>
56
/// <param name="person"></param>
57
/// <returns></returns>
58
protected static bool getByAge(Person person)
59
{
60
return person.Age > 5;
61
}
62![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
63
/// <summary>
64
/// 打印信息到屏幕
65
/// </summary>
66
/// <param name="results"></param>
67
static void Print(IEnumerable<Person> results)
68
{
69![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
70
foreach (Person person in results)
71
{
72
Console.WriteLine(string.Format("Name is : {0} , Age is : {1}", person.Name, person.Age));
73
}
74
}
75
}
76![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
77
/// <summary>
78
/// Person类
79
/// </summary>
80
public class Person
81
{
82
public Person()
83
{ }
84
private string _name;
85![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
86
public string Name
87
{
88
get { return _name; }
89
set { _name = value; }
90
}
91
private int _age;
92![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
93
public int Age
94
{
95
get { return _age; }
96
set { _age = value; }
97
}
98![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
99
}
100![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
101
/// <summary>
102
/// PersonHelper类
103
/// </summary>
104
public class PersonHelper
105
{
106
/// <summary>
107
/// 存放Person的列表
108
/// </summary>
109
List<Person> _list;
110![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
111
public List<Person> List
112
{
113
get { return _list; }
114
115
}
116![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
117
public PersonHelper()
118
{
119
_list = new List<Person>();
120
121
}
122![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
123
/// <summary>
124
/// 方法1:通过Linq返回结果
125
/// </summary>
126
/// <param name="age"></param>
127
/// <returns></returns>
128
public IEnumerable<Person> GetPersonByLinq(int age)
129
{
130
return from ps in List
131
where ps.Age > age
132
select ps;
133
}
134![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
135
/// <summary>
136
/// 方法2:通过Lambda返回结果
137
/// </summary>
138
/// <param name="age"></param>
139
/// <returns></returns>
140
public IEnumerable<Person> GetPersonByLambda(int age)
141
{
142
return Enumerable.Where<Person>(List, ps => (ps.Age > age));
143
}
144![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
145
/// <summary>
146
/// 方法3:通过匿名方法返回结果
147
/// </summary>
148
/// <param name="age"></param>
149
/// <returns></returns>
150
public IEnumerable<Person> GetPersonByAnonymouseMethod(int age)
151
{
152![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
153
return Enumerable.Where<Person>(List,
154
delegate(Person ps) { return ps.Age > age; });
155
}
156![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
157
/// <summary>
158
/// 方法4:通过代理函数返回结果
159
/// </summary>
160
/// <param name="func"></param>
161
/// <returns></returns>
162
public IEnumerable<Person> GetPersonBydelegate(Func<Person,bool> func)
163
{
164
return Enumerable.Where<Person>(List, func);
165
}
166
}
167
}
最终输出结果为:![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
27
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
28
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
29
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
30
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
31
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
32
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
33
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
34
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
35
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
36
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
37
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
38
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
39
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
40
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
41
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
42
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
43
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
44
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
45
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
46
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
47
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
48
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
49
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
50
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
51
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
52
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
53
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
54
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
55
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
56
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
57
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
58
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
59
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
60
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
61
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
62
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
63
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
64
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
65
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
66
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
67
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
68
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
69
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
70
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
71
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
72
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
73
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
74
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
75
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
76
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
77
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
78
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
79
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
80
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
81
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
82
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
83
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
84
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
85
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
86
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
87
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
88
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
89
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
90
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
91
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
92
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
93
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
94
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
95
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
96
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
97
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
98
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
99
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
100
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
101
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
102
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
103
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
104
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
105
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
106
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
107
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
108
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
109
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
110
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
111
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
112
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
113
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
114
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
115
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
116
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
117
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
118
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
119
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
120
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
121
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
122
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
123
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
124
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
125
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
126
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
127
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
128
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
129
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
130
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
131
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
132
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
133
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
134
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
135
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
136
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
137
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
138
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
139
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
140
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
141
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
142
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
143
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
144
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
145
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
146
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
147
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
148
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
149
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
150
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
151
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
152
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
153
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
154
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
155
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
156
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
157
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
158
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
159
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
160
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
161
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
162
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
163
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
164
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
165
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
166
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
167
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
Name is : Jiessieliang6 , Age is : 6
Name is : Jiessieliang6 , Age is : 6
Name is : Jiessieliang6 , Age is : 6
Name is : Jiessieliang6 , Age is : 6
同一个查询,可以通过Linq,Lambda表达式,匿名方法和代理来实现。
================================================================
转载要求及授权协议:
作者: 零零猪(or)Jiessie327(or)JiessieLiang
出处:http://jiessie327.cnblogs.com/
版权:本文版权归作者所有
转载:欢迎转载,为了尊重作者的劳动成果,在【转载】时请按作者要求,指明文章【出处】或给出【原文链接】,谢谢
================================================================
请遵守署名-非商业性使用-禁止演绎 2.5 中国大陆 License.
================================================================
转载要求及授权协议:
作者: 零零猪(or)Jiessie327(or)JiessieLiang
出处:http://jiessie327.cnblogs.com/
版权:本文版权归作者所有
转载:欢迎转载,为了尊重作者的劳动成果,在【转载】时请按作者要求,指明文章【出处】或给出【原文链接】,谢谢
================================================================
请遵守署名-非商业性使用-禁止演绎 2.5 中国大陆 License.
![](http://i.creativecommons.org/l/by-nc-nd/2.5/cn/88x31.png)
================================================================