title: c# and LINQ - convert IGrouping to List
body: <p>I have the following code written to find common objects in a list of objects</p>
  
  <p><a href="https://dotnetfiddle.net/gCgNBf" rel="nofollow">https://dotnetfiddle.net/gCgNBf</a></p>
  
  <p>..............................</p>
  
  <pre><code>var query = setOfPersons
              .SelectMany(l =&gt; l.Select(l1 =&gt; l1))
              .GroupBy(p =&gt; p.Id)
              .Where(g =&gt; g.Count() == setOfPersons.Count);
  </code></pre>
  
  <p>After that, I need to convert "query" to a list of "Person" objects ( List ) to achieve something else. </p>
  
  <p>I tried using <strong>"ToList()"</strong>... But it says:</p>
  
  <blockquote>
    <blockquote>
      <p>" cannot convert IGrouping to a List ".</p>
    </blockquote>
  </blockquote>
  
  <p>Can someone help me to fix it ?</p>