一图胜千言 – System.Linq.IEnumerable vs System.Linq.IQuerable

原文链接: http://www.cnblogs.com/jamesleng/archive/2011/10/28/2226901.html

此图以一个具体的Linq Query为例,对IEnumerable<T>和IQuerable<T>进行了比较性剖析。如果users支持IQuerable<T>,则走右边分支,如果仅支持IEnumerable<T>则走左边分支。玄机尽在图中,尤其是expression tree作为众多Linq Provider变戏法的关键性支撑作用,可谓不言而喻。此图和一图胜千言 – Linq2Ojects vs Linq2?相得益彰,前者是具体的实例,后者是抽象的机理。而IEnumerable<T>对应的是Linq2Objects,IQuerable<T>对应的是Linq2Sql或其它的Linq Provider了。

(按:picture source from <<C# in Depth>> 2nd.Edition Jon Skeet)

转载于:https://www.cnblogs.com/jamesleng/archive/2011/10/28/2226901.html

猜你喜欢

转载自blog.csdn.net/weixin_30571465/article/details/94786449