LINQ的触发机制——Lazy Evaluation

比如:下面一个题目
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的时候才会被执行。

 
posted @ 2008-06-15 22:34  蜡笔小王  阅读(235)  评论(0)    收藏  举报