<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MyVerbalOutlet &#187; linq</title>
	<atom:link href="http://www.myverbaloutlet.net/tag/linq/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.myverbaloutlet.net</link>
	<description>This is where I spout off about stuff</description>
	<lastBuildDate>Tue, 31 Aug 2010 16:05:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>LINQ Distinct Fix</title>
		<link>http://www.myverbaloutlet.net/2009/12/linq-distinct-fix/</link>
		<comments>http://www.myverbaloutlet.net/2009/12/linq-distinct-fix/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 20:54:39 +0000</pubDate>
		<dc:creator>Matthew</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[linq]]></category>

		<guid isPermaLink="false">http://www.myverbaloutlet.net/?p=378</guid>
		<description><![CDATA[I needed to use the LINQ Distinct operation on a list of objects today and I ran into the fact that Distinct doesn&#8217;t take a lambda expression. You have to create a class that inherits IEqualityComparer and implements both the Equals and GetHashCode methods. This seems like a real pain to me. Distinct should take [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to use the LINQ Distinct operation on a list of objects today and I ran into the fact that Distinct doesn&#8217;t take a lambda expression. You have to create a class that inherits IEqualityComparer and implements both the Equals and GetHashCode methods. This seems like a real pain to me. Distinct should take a lambda expression like the rest of the LINQ operators.</p>
<p>I found a workaround by using GroupBy, First, and Select like so.</p>
<pre name="code" class="c-sharp:nogutter">
var distinct = collection
       .GroupBy(c =&gt; c.FilterProperty)
       .Select(c =&gt; c.First())
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.myverbaloutlet.net/2009/12/linq-distinct-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
