title: Group by in LINQ
body: <p>Let's suppose if we have a class like:</p>
  
  <pre><code>class Person { 
      internal int PersonID; 
      internal string car; 
  }
  </code></pre>
  
  <p>I have a list of this class: <code>List&lt;Person&gt; persons;</code></p>
  
  <p>And this list can have multiple instances with same <code>PersonID</code>s, for example: </p>
  
  <pre><code>persons[0] = new Person { PersonID = 1, car = "Ferrari" }; 
  persons[1] = new Person { PersonID = 1, car = "BMW"     }; 
  persons[2] = new Person { PersonID = 2, car = "Audi"    }; 
  </code></pre>
  
  <p>Is there a way I can group by <code>PersonID</code> and get the list of all the cars he has? </p>
  
  <p>For example, the expected result would be </p>
  
  <pre><code>class Result { 
     int PersonID;
     List&lt;string&gt; cars; 
  }
  </code></pre>
  
  <p>So after grouping, I would get: </p>
  
  <pre><code>results[0].PersonID = 1; 
  List&lt;string&gt; cars = results[0].cars; 
  
  result[1].PersonID = 2; 
  List&lt;string&gt; cars = result[1].cars;
  </code></pre>
  
  <p>From what I have done so far: </p>
  
  <pre><code>var results = from p in persons
                group p by p.PersonID into g
                select new { PersonID = g.Key, // this is where I am not sure what to do
  </code></pre>
  
  <p>Could someone please point me in the right direction? </p>