<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>LINQ Farm: LINQ Sets</title><link>http://blogs.msdn.com/charlie/archive/2006/12/28/linq-farm-linq-sets.aspx</link><description>This is the sixth in a series of articles on LINQ. In this post the focus will be on the LINQ Set operators. Near the end of the post I include a short section on the importance of choosing the best operator for a particular task. Please see the links</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>LINQ Farm: LINQ Sets</title><link>http://blogs.msdn.com/charlie/archive/2006/12/28/linq-farm-linq-sets.aspx#1378626</link><pubDate>Fri, 29 Dec 2006 09:11:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1378626</guid><dc:creator>DotNetKicks.com</dc:creator><description>&lt;p&gt;You've been kicked (a good thing) - Trackback from DotNetKicks.com&lt;/p&gt;
</description></item><item><title>re: LINQ Farm: LINQ Sets</title><link>http://blogs.msdn.com/charlie/archive/2006/12/28/linq-farm-linq-sets.aspx#1378673</link><pubDate>Fri, 29 Dec 2006 09:56:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1378673</guid><dc:creator>zproxy</dc:creator><description>&lt;p&gt;Why o why are you using &lt;/p&gt;
&lt;p&gt;where p.OperatorType.Equals(operatorType)&lt;/p&gt;
&lt;p&gt;In case of comparing string to string the == operator is sufficient.&lt;/p&gt;
&lt;p&gt;where p.OperatorType == operatorType&lt;/p&gt;
&lt;p&gt;cheers.&lt;/p&gt;
</description></item><item><title>re: LINQ Farm: LINQ Sets</title><link>http://blogs.msdn.com/charlie/archive/2006/12/28/linq-farm-linq-sets.aspx#1381580</link><pubDate>Sat, 30 Dec 2006 02:20:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1381580</guid><dc:creator>Charlie Calvert</dc:creator><description>&lt;p&gt;zproxy,&lt;/p&gt;
&lt;p&gt;I asked around, and it looks like you are right. I should have written == instead of calling MyString.Equals. As far as I can tell, the result will be the same in every case unless MyString is null in which case == will handle it correctly and MyString.Equals will blow up.&lt;/p&gt;
&lt;p&gt;Here is some code I played around with once you got me interested in this subject:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string a = &amp;quot;foo&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string b = &amp;quot;foo&amp;quot;;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string c = string.Copy(a);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string d = null;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(a == b);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(a == c);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(a.Equals(b));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(a.Equals(c)); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(String.Equals(a, b));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(String.Equals(a, c));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(String.Equals((object)a, (object)b));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(String.Equals((object)a, (object)c));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine((object)a == (object)c);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(String.ReferenceEquals(a, b));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(String.ReferenceEquals(a, c));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(d == a);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Console.WriteLine(d.Equals(a));&lt;/p&gt;
&lt;p&gt;- Charlie&lt;/p&gt;
</description></item><item><title>re: LINQ Farm: LINQ Sets</title><link>http://blogs.msdn.com/charlie/archive/2006/12/28/linq-farm-linq-sets.aspx#1873969</link><pubDate>Tue, 13 Mar 2007 19:25:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1873969</guid><dc:creator>scobrown</dc:creator><description>&lt;p&gt;How does the performance compare between a set function like Except and a Where function?&lt;/p&gt;
&lt;p&gt;Suppose you needed both a list of even numbers and a list of odd numbers. &amp;nbsp;Would you be better off deriving both from the original list using Where? &amp;nbsp;Or deriving one and using Except to generate the other?&lt;/p&gt;
&lt;p&gt;Would it matter how many items were in the list?&lt;/p&gt;
</description></item><item><title>LINQ Farm: More on Set Operators</title><link>http://blogs.msdn.com/charlie/archive/2006/12/28/linq-farm-linq-sets.aspx#8728883</link><pubDate>Sun, 13 Jul 2008 19:38:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8728883</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>&lt;p&gt;This is a second article on the LINQ Set operators, the first being published while LINQ was still in&lt;/p&gt;
</description></item></channel></rss>