title: Generate number sequences with LINQ
body: <p>I try to write a LINQ statement which returns me all possible combinations of numbers (I need this for a test and I was inspired by this <a href="http://blogs.msdn.com/ericlippert/archive/2010/04/19/every-binary-tree-there-is.aspx" rel="noreferrer">article of Eric Lippert</a>). The method's prototype I call looks like:</p>
  
  <pre><code>IEnumerable&lt;Collection&lt;int&gt;&gt; AllSequences( int start, int end, int size );
  </code></pre>
  
  <p>The rules are:</p>
  
  <ul>
  <li>all returned collections have a length of <code>size</code> </li>
  <li>number values within a collection have to increase</li>
  <li>every number between <code>start</code> and <code>end</code> should be used</li>
  </ul>
  
  <p>So calling the <code>AllSequences( 1, 5, 3 )</code> should result in 10 collections, each of size 3:</p>
  
  <pre><code>1 2 3
  1 2 4
  1 2 5
  1 3 4
  1 3 5
  1 4 5
  2 3 4 
  2 3 5
  2 4 5 
  3 4 5
  </code></pre>
  
  <p>Now, somehow I'd really like to see a <strong>pure LINQ</strong> solution. I am able to write a non LINQ solution on my own, so please put no effort into a solution without LINQ.<br>
  My tries so far ended at a point where I have to join a number with the result of a recursive call of my method - something like:</p>
  
  <pre><code>return from i in Enumerable.Range( start, end - size + 1 )
         select BuildCollection(i, AllSequences( i, end, size -1));
  </code></pre>
  
  <p>But I can't manage it to implement <code>BuildCollection()</code> on a LINQ base - or even skip this method call. Can you help me here?</p>