title: Compare Two Lists Via One Property Using LINQ
body: <p>Say I have the following:</p>
  
  <pre><code>    class Widget1{
          public int TypeID { get; set; }
          public string Color { get; set; }
      }
  
      class Widget2
      {
          public int TypeID { get; set; }
          public string Brand { get; set; }
      }
  
      private void test()
      {
          List&lt;Widget1&gt; widgets1 = new List&lt;Widget1&gt;();
          List&lt;Widget2&gt; widgets2 = new List&lt;Widget2&gt;();
          List&lt;Widget1&gt; widgets1_in_widgets2 = new List&lt;Widget1&gt;();
  
          //some code here to populate widgets1 and widgets2
  
          foreach (Widget1 w1 in widgets1)
          {
              foreach (Widget2 w2 in widgets2)
              {
                  if (w1.TypeID == w2.TypeID)
                  {
                      widgets1_in_widgets2.Add(w1);
                  }
              }
          }
      }
  </code></pre>
  
  <p>I am using two foreach loops to compare the lists by TypeID to populate a third list.
  Is there any other way using LINQ to compare these two lists via the TypeID? Perhaps using Interstect or some other function?</p>