All combinations of a list
<p>I'd like to be able to take a list like this</p>

<pre><code>var list = new List&lt;int&gt;{0,1,2};
</code></pre>

<p>And get a result like this</p>

<pre><code>var result = new List&lt;List&lt;int&gt;&gt;{
    new List&lt;int&gt;{0,1,2},
    new List&lt;int&gt;{0,2,1},
    new List&lt;int&gt;{1,0,2},
    new List&lt;int&gt;{1,2,0},
    new List&lt;int&gt;{2,0,1},
    new List&lt;int&gt;{2,1,0}
};
</code></pre>

<p>I'm not interested in sets with missing numbers, just combinations of the numbers that exist.</p>

<p>Any ideas?</p>

<h1>Also, I've looked into solutions like <a href="http://stackoverflow.com/questions/3319586/getting-all-possible-permutations-from-a-list-of-numbers">Getting all possible permutations from a list of numbers</a> already, and they don't fit. That one gives me something like this</h1>

<pre><code>var result =new List&lt;List&lt;int&gt;&gt;{
   //[[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
   //Serialized the result to JSON so it would be quicker.
};
</code></pre>

<h1>And it doesn't spit out all of the combinations.</h1>
