title: Split a List<int> into groups of consecutive numbers
body: <p>I have a sorted <code>List&lt;int&gt;</code> like <code>{ 1, 2, 3, 4, 6, 7, 9 }</code><br>
  I want to split that into some groups -- every group has consecutive number like this: <code>{ {1, 2, 3, 4}, {6, 7}, {9} }</code></p>
  
  <p>I know I can use <code>for</code> loop to traverse the list, and compare between the current value and previous value, then decide whether append to last group or create a new group. But I want to find a "pretty" way to do it. Maybe use LINQ?</p>
  
  <p>Edit:</p>
  
  <p>I found a python code from project <a href="https://github.com/erikrose/more-itertools/blob/master/more_itertools/more.py#L1661" rel="noreferrer">more-itertools</a>:</p>
  
  <pre><code>def consecutive_groups(iterable, ordering=lambda x: x):
      for k, g in groupby(
          enumerate(iterable), key=lambda x: x[0] - ordering(x[1])
      ):
          yield map(itemgetter(1), g)
  </code></pre>