I have a 2 dimensional array, that is a 2D array. I don't want to flatten out this array and sort. Basically i want to sort it by column.
Here is what i want
int [,] numbers = new int[4,3] { { -1,3,5 }, {5,6,8 },{-1,0,2},{2,3,5} };
o/p expected = [{-1,0,2},{ -1,3,5 },{2,3,5},{5,6,8 }
I am not able to get a good explanation because most of the blogs i came across flatten out the array and then sort all the elements which is not what i want. Any info is highly appreciated
I can think of sorting first item of each array and then sort it . If first item is same, then look for second one and so on..but not getting the right syntax