title: c# and LINQ- group objects based on their IDs and then find common values in them
body: <p>I have a object collection like in the following.</p>
  
  <pre><code>  List&lt;Product&gt; productList=new List&lt;Product&gt;();
  </code></pre>
  
  <p>Structure of the class <strong>Product</strong> is like in the following.</p>
  
  <pre><code>   public class Product
     {
         public  int Id;
         public Product(int id)
         {
            Id=id;
  
         }
  
         public List&lt;SomeOtherList&gt; t;
    }
  </code></pre>
  
  <p>The class <strong>Product</strong> contains some other list</p>
  
  <pre><code>    public class SomeOtherList 
      {
          private int value;
  
          public  SomeOtherList(int val)
          {
              value=val;
  
         }
  
  
     }
          Product prodOne=new Product(1);
          List&lt;SomeOtherList&gt; temp_1=new List&lt;SomeOtherList&gt;();
          temp_1.Add(new SomeOtherList(10));
         temp_1.Add(new SomeOtherList(20));
         temp_1.Add(new SomeOtherList(30));
         prodOne.t=temp_1;
  
         Product prodTwo=new Product(2);
         List&lt;SomeOtherList&gt; temp_2=new List&lt;SomeOtherList&gt;();
         temp_2.Add(new SomeOtherList(100));
         temp_2.Add(new SomeOtherList(40));
         temp_2.Add(new SomeOtherList(30));
         prodTwo.t=temp_2;
  
  
         Product prodThree=new Product(1);
         List&lt;SomeOtherList&gt; temp_3=new List&lt;SomeOtherList&gt;();
         temp_3.Add(new SomeOtherList(10));
         temp_3.Add(new SomeOtherList(20));
  
         prodThree.t=temp_3;
  
  
  
        productList.Add(prodOne);
        productList.Add(prodTwo);
        productList.Add(prodThree);
  </code></pre>
  
  <p>I want to get "SomeOtherList" objects common to all the Products. For example, for Product Id 1, I should get SomeOtherList object 20 as the common One.</p>
  
  <p>I have written the following LINQ query to achieve this.</p>
  
  <pre><code>   List&lt;Product&gt; t=productList
                            .GroupBy(p =&gt; p.Id)
                            .Where(g =&gt; g.Count() == productList.Count)
                            .Select(x =&gt; x.First())
                            .ToList();
  </code></pre>
  
  <p>But it does not give me what I want . Can someone point what is wrong with that query ?</p>