<p>Another easy one hopefully.</p>

<p>Let's say I have a collection like this:</p>

<pre><code>List&lt;DateTime&gt; allDates;
</code></pre>

<p>I want to turn that into </p>

<pre><code>List&lt;List&lt;DateTime&gt;&gt; dividedDates;
</code></pre>

<p>where each List in 'dividedDates' contains all of the dates in 'allDates' that belong to a distinct year.</p>

<p>Is there a bit of LINQ trickery that my tired mind can't pick out right now?</p>

<p><strong>Solution</strong></p>

<p>The Accepted Answer is correct.</p>

<p>Thanks, I don't think I was aware of the 'into' bit of GroupBy and I was trying to use the .GroupBy() sort of methods rather than the SQL like syntax.  And thanks for confirming the ToList() amendment and including it in the Accepted Answer :-)</p>

```
```
var q  = from date in allDates 
         group date by date.Year into datesByYear
         select datesByYear.ToList();
q.ToList(); //returns List<List<DateTime>>
```
```