<?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: Are you sure you want List?  Maybe you really want HashSet</title>
	<atom:link href="http://graemehill.ca/are-you-sure-you-want-list-maybe-you-really-want-hashset/feed" rel="self" type="application/rss+xml" />
	<link>http://graemehill.ca/are-you-sure-you-want-list-maybe-you-really-want-hashset</link>
	<description></description>
	<pubDate>Sat, 19 May 2012 08:26:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Graeme</title>
		<link>http://graemehill.ca/are-you-sure-you-want-list-maybe-you-really-want-hashset/comment-page-1#comment-897</link>
		<dc:creator>Graeme</dc:creator>
		<pubDate>Tue, 08 Feb 2011 21:15:33 +0000</pubDate>
		<guid isPermaLink="false">http://graemehill.ca/?p=347#comment-897</guid>
		<description>That's an excellent point and I hadn't really thought about it much, but it can definitely be problematic if client code can add new elements to the collection when it isn't supposed to.  On the other hand, I have often found myself specifically using List instead of IEnumerable even though I don't want List functionality because of this issue: http://graemehill.ca/linq-queries-return-queries-not-data (I explain the problem with IEnumerable in the last paragraph).  Basically, if you have an object of type IEnumerable all you know is that it is enumerable (duh) but you don't know if it has been evaluated yet (it could be lazy loaded data from an ORM).  If you use list at least you know that when you try to examine the collection it won't hit the database or anything.  Ideally there would be a happy medium, like IPreloadedEnumerable or something.</description>
		<content:encoded><![CDATA[<p>That&#8217;s an excellent point and I hadn&#8217;t really thought about it much, but it can definitely be problematic if client code can add new elements to the collection when it isn&#8217;t supposed to.  On the other hand, I have often found myself specifically using List instead of IEnumerable even though I don&#8217;t want List functionality because of this issue: <a href="http://graemehill.ca/linq-queries-return-queries-not-data"  rel="nofollow">http://graemehill.ca/linq-queries-return-queries-not-data</a> (I explain the problem with IEnumerable in the last paragraph).  Basically, if you have an object of type IEnumerable all you know is that it is enumerable (duh) but you don&#8217;t know if it has been evaluated yet (it could be lazy loaded data from an ORM).  If you use list at least you know that when you try to examine the collection it won&#8217;t hit the database or anything.  Ideally there would be a happy medium, like IPreloadedEnumerable or something.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brad Cunningham</title>
		<link>http://graemehill.ca/are-you-sure-you-want-list-maybe-you-really-want-hashset/comment-page-1#comment-895</link>
		<dc:creator>Brad Cunningham</dc:creator>
		<pubDate>Tue, 08 Feb 2011 00:09:44 +0000</pubDate>
		<guid isPermaLink="false">http://graemehill.ca/?p=347#comment-895</guid>
		<description>Good call. I also find a lot of places where someone will use a List out of habit when all they really need is IEnumerable. List exposes your collection to the consumer in ways that maybe you didn't want to allow. Being able to change the collection out from underneath isn't always desirable</description>
		<content:encoded><![CDATA[<p>Good call. I also find a lot of places where someone will use a List out of habit when all they really need is IEnumerable. List exposes your collection to the consumer in ways that maybe you didn&#8217;t want to allow. Being able to change the collection out from underneath isn&#8217;t always desirable</p>
]]></content:encoded>
	</item>
</channel>
</rss>

