title: Check if a list contains all of another lists items when comparing on one property
body: <p>I am learning Linq and I have two object lists. I want to compare one of these lists against the other to see if all of one of the properties of the objects within it can be matched to those in the other list.
  So, I provide code for that but I want to change it to Linq expressions.</p>
  <pre><code>var list1 = new List&lt;Product&gt;
  {
      new Product{SupplierId = 1,ProductName = &quot;Name1&quot;},
      new Product{SupplierId = 2,ProductName = &quot;Name2&quot;},
      new Product{SupplierId = 3,ProductName = &quot;Name3&quot;},
      new Product{SupplierId = 4,ProductName = &quot;Name4&quot;}
  };
  
  var list2 = new List&lt;Product&gt;
  {
      new Product {SupplierId = 1,ProductName = &quot;Name5&quot;},
      new Product {SupplierId = 4,ProductName = &quot;Name6&quot;}
  };
  
  private static bool CheckLists(List&lt;Product&gt; list1, List&lt;Product&gt; list2)
  {
      foreach (var product2 in list2)
      {
          bool result = false;
          foreach (var product in list1)
          {
              if (product.SupplierId == product2.SupplierId)
              {
                  result = true;
                  break;
              }
          }
          if (!result)
          {
              return false;
          }
      }
      return true;
  }
  </code></pre>
  <p>How can I do it using LINQ?</p>