title: C# Multi-dimensional list sort
body: <p>I'm looking for the best way, in term of time performance, to sort multi-dimensional list.
  I have a multi-dimensional list with millions rows and variable number(1-10) of columns.</p>
  <pre><code>List&lt;List&lt;int?&gt;&gt; multiDimensionalList = new List&lt;List&lt;int?&gt;&gt;//();
              {
              new List&lt;int?&gt;  { 0     ,8      ,57     ,5},
              new List&lt;int?&gt;  { 1     ,4      ,2      ,7},
              new List&lt;int?&gt;  { 2     ,0      ,-55    ,9},
              new List&lt;int?&gt;  { 3     ,8      ,57     ,2},
              new List&lt;int?&gt;  { 4     ,2      ,-120   ,4},
              new List&lt;int?&gt;  { 5     ,3      ,57     ,5},
          };
  int[] orderParameters = { 2, 3, 1 };
  </code></pre>
  <p>I have to order this list using the order parameters columns in input.</p>
  <pre><code>List&lt;List&lt;int?&gt;&gt; sortedExample = new List&lt;List&lt;int?&gt;&gt;
              {
              new List&lt;int?&gt;  {4      ,2      ,-120   ,4},
              new List&lt;int?&gt;  {2      ,0      ,-55    ,9},
              new List&lt;int?&gt;  {1      ,4      ,2      ,7},
              new List&lt;int?&gt;  {3      ,8      ,57     ,2},
              new List&lt;int?&gt;  {5      ,3      ,57     ,5},
              new List&lt;int?&gt;  {0      ,8      ,57     ,5},
          };
  </code></pre>
  <p>Simple implementation using Linq:</p>
  <pre><code>List&lt;List&lt;int?&gt;&gt; sortedList = multiDimensionalList
              .OrderBy(x =&gt; x[orderParameters[2]])
              .OrderBy(y =&gt; y[orderParameters[1]])
              .OrderBy(z =&gt; z[orderParameters[0]])
              .ToList();
  </code></pre>
  <p>Do you know a better solution?</p>
  <blockquote>
  <p>This task is requested frequently and it must be single thread.</p>
  <p>Performances regard generation of sortedList from multiDimensionalList.</p>
  </blockquote>