<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title>DongPad</title><link>http://www.dongpad.com</link> <description>Every day is a new beginning!</description><copyright>2.0 beta 03</copyright> <language>zh-cn</language><item><title>IQueryable&lt;T&gt; vs IEnumerable&lt;T&gt;</title><description><![CDATA[<p>IQueryable<T> is a very powerful feature that enables a variety of interesting <font color="#ff0000"><strong>deferred execution       <br /></strong></font>scenarios (like paging and composition based queries). As with all powerful features, you want to be    <br />careful with how you use it and make sure it is not abused.    <br />It is important to recognize that returning an IQueryable<T> result from your repository <strong><font color="#ff0000">enables calling       <br />code to append on chained operator methods to it, and so participate in the ultimate query execution</font></strong>.    <br />If you do not want to provide calling code this ability, then you should return back <strong><font color="#ff0000">IList<T>, List<T> or       <br />IEnumerable<T> results - which contain the results of a query that has already executed</font></strong>.    <br />For pagination scenarios this would require you to push the actual data pagination logic into the    <br />repository method being called. In this scenario we might update our FindUpcomingDinners() finder    <br />method to have a signature that either returned a PaginatedList:    <br />PaginatedList< Dinner> FindUpcomingDinners(int pageIndex, int pageSize) { }    <br />Or return back an IList<Dinner>, and use a “totalCount” out param to return the total count of Dinners:    <br />IList<Dinner> FindUpcomingDinners(int pageIndex, int pageSize, out int totalCount) { }</p>  <p>From the NerdDiner Pro!</p>]]></description><author>Jack</author><link>http://www.dongpad.com/CSharp-20090703-199.html</link><pubdate>2009-7-3 10:00:46</pubdate></item></channel></rss>
