请帮助我清楚地理解这个概念。
我有一个 IEnumberable 的员工名单,
例如:
var emplist = new List<Employee> ()
{
new Employee { EmpID = 1, EmpName = 'emp1', Age = 21},
new Employee { EmpID = 2, EmpName = 'emp2', Age = 26},
new Employee { EmpID = 3, EmpName = 'emp3',Age = 28}
};
IEnumerable
var lst = from emp in emplist
where emp.Age > 25
select emp;
// Returns IEnumerable and subjected to deferred execution.
var singleemp = lst.Take(1); // for filtering first employee.
可查询
IQueryeable<Employee> lst = from emp in emplist
where emp.Age > 25
select emp;
// Returns IQuereable and subjected to deferred execution.
var singleemp = lst.Take(1); // for filtering first employee.
现在在这里我有 IEnumerable 和 IQuereable 两种情况,但是在 DB 中生成的 Sql 查询是不同的。但两者都受到延期执行。那么这两种情况有什么不同!
请有人对此提供提示...