现在的位置: 首页 > 综合 > 正文

LINQ的触发机制——Lazy Evaluation

2012年05月08日 ⁄ 综合 ⁄ 共 198字 ⁄ 字号 评论关闭
比如:下面一个题目
public static bool dump(Doctor d)
{
  System.Console.WriteLine(d.Initials);
  return true;
}
 
var query = from d in doctors
            where dump(d)
            select d; 
 
 
问输出是?
nothing。 
因为只有在首次真正Request的时候才会被执行。

抱歉!评论已关闭.