There is ambiguity about what you're trying to achieve. Are you looking to keep the "grid rows" in sync with each other when you sort by one of the "columns"? Or are you expecting to just have the values from a single "column" returned in order, separately from the other "columns"?
If it's the first, then I'd recommend following this example from another question similar to this one, and leverage the DataTable
class to keep your rows from getting mixed up.
If it's the second, then you can just order the column via array[0].OrderBy(x=>x);
btw, I think with your code...
int[,] ordered = array.OrderBy(x => x[0]).ToArray();
...that you were looking to use the int[][]
type array, not the int[,]
type array. The OrderBy
exists for the other one, but it doesn't do what you're expecting I don't think. I've just tried it and I can't figure out what it's even doing.
Hope this helps!