The title suggests that i\'ve already an idea what\'s going on, but i cannot explain it. I\'ve tried to order a List dynamically by each \"colum
It's the same problem as lots of people had with foreach loops pre C# 5.
orderedValues = orderedValues.ThenBy(t => t[i]);
The value of i will not be evaluated until you call .ToList() at which point it is 2 since that's the exit condition of the for loop.
You can introduce a new local variable inside the for-loop to fix it:
for (int i = 1; i < minDim; i++)
{
var tmp = i;
orderedValues = orderedValues.ThenBy(t => t[tmp]);
}
For more information you could take a look at Eric Lippert's blog post about Closing over the loop variable considered harmful.