title: Iterate and return array of consecutive n elements
body: <p>In Ruby there is an <code>each_cons</code> on <a href="http://www.ruby-doc.org/core/classes/Enumerable.html#M001515" rel="noreferrer">Enumerable</a>. It works like this</p>
  
  <pre><code>(1..5).each_cons(3) {|n| p n}
  </code></pre>
  
  <blockquote>
    <p>[1, 2, 3]<br>
    [2, 3, 4]<br>
    [3, 4, 5]</p>
  </blockquote>
  
  <p>I would like to do this in C#. LINQ would be nice.</p>
  
  <p>The following does something similar but it loops one to many and it's also hardcoded to return only two elements </p>
  
  <pre><code>var ints = new int[] { 1, 2, 3, 4, 5, 6, 7 };
  var cons = ints.Select((o, i) =&gt;
              new int[]{ ints[i], i == ints.Length - 1 ? 0 : ints[i + 1] });
  </code></pre>
  
  <p>It would be nice if it could be created as an iterator over the original array instead of having to create a lot of arrays.</p>