<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Counting Objects In A List in C# 3.5</title>
	<atom:link href="http://www.rorydriscoll.com/2008/07/18/counting-objects-in-a-list-in-c-35/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rorydriscoll.com/2008/07/18/counting-objects-in-a-list-in-c-35/</link>
	<description></description>
	<lastBuildDate>Sat, 28 Jan 2012 01:33:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Pop Catalin</title>
		<link>http://www.rorydriscoll.com/2008/07/18/counting-objects-in-a-list-in-c-35/comment-page-1/#comment-22</link>
		<dc:creator>Pop Catalin</dc:creator>
		<pubDate>Tue, 09 Sep 2008 19:07:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.rorydriscoll.com/?p=29#comment-22</guid>
		<description>Linq Count() method is there because you can chain linq operators and you could do something like

int itemCount = colection.Take(10).Where( someLambda ).Skip(2).Count();

So, having a Count method that works on any IEnumerable is usefull for....well counting things in that enumerable.

Also Count has an overload that takes a Func that can be used to count elements that meet a certain criteria.

Most linq operators are deferred ( http://blogs.msdn.com/charlie/archive/2007/12/09/deferred-execution.aspx ) so having a Count method is useful because Linq results are not collections but enumerators that only execute when they are iterated over and that means the number of elements is unknown until the iteration completes, so that count can&#039;t be exposed as a property.</description>
		<content:encoded><![CDATA[<p>Linq Count() method is there because you can chain linq operators and you could do something like</p>
<p>int itemCount = colection.Take(10).Where( someLambda ).Skip(2).Count();</p>
<p>So, having a Count method that works on any IEnumerable is usefull for&#8230;.well counting things in that enumerable.</p>
<p>Also Count has an overload that takes a Func that can be used to count elements that meet a certain criteria.</p>
<p>Most linq operators are deferred ( <a href="http://blogs.msdn.com/charlie/archive/2007/12/09/deferred-execution.aspx" rel="nofollow">http://blogs.msdn.com/charlie/archive/2007/12/09/deferred-execution.aspx</a> ) so having a Count method is useful because Linq results are not collections but enumerators that only execute when they are iterated over and that means the number of elements is unknown until the iteration completes, so that count can&#8217;t be exposed as a property.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

