title: Getting the difference between two Lists based on certain fields
body: <p>I'm fairly new to LINQ and I may have painted myself to a corner here. I have two lists (left and right) and I need to:</p>
  
  <p><em>a</em>) Get matching items based on certain fields</p>
  
  <p><em>b</em>) Get items on the left with no match on the right </p>
  
  <p><em>c</em>) Get items on the right with no match on the left</p>
  
  <p>A match is found if certain fields are equal. Other fields may or may not contain values but must not influence the match comparison.</p>
  
  <p>To get item <em>a</em> I performed a <code>JOIN</code> on both lists:</p>
  
  <pre><code>var q = from a in r1
          from b in r2
          where a.Prop1 == b.Prop1 &amp;&amp; a.Prop3 == b.Prop3
          select new { a.Prop1, a.Prop2, b.Prop3 };
  </code></pre>
  
  <p>I'm not sure on where to go from here. I <em>think</em> I cannot use <code>.Except()</code> because the other properties for both lists will be different and may cause the comparison to break.</p>
  
  <p>I also tried using <code>Left Join</code> and get the items with no matches:</p>
  
  <pre><code> var q =
       from c in r1
       join p in r2 on c.Prop1 equals p.Prop1
       into cp
       from p in cp.DefaultIfEmpty()
       select new { Prop1 = c.Prop1, Prop2 = p == null ? "N/A" : p.Prop2 };
  </code></pre>
  
  <p>however I found out that you can't compare more than one field to compare.</p>
  
  <p>Can you have more than one fields on a <code>Left Join</code> with LINQ?
  Are there other ways (besides LINQ) to get the difference between two lists?</p>