I have a jagged array and I need to sort it by the column "2":
example: array[x][2]
What I have is about 64 where the "x" is and in the second column (where the "2" is) I have 4 different options, but I need to sort by the second option.
Just use OrderBy:
OrderBy
array = array.OrderBy(inner => inner[2]).ToArray();
If it's important to use an in place sort then you can use Array.Sort:
Array.Sort
Array.Sort(array, (first, second) => string.Compare(first[2], second[2]));
2.1m questions
2.1m answers
60 comments
57.0k users