Trying to Sort a Multi Dimensional Array

I’m trying to sort a two dimensional array and I’m having a problem with the Unity syntax (or something).

I took this example from online and I thought it should work but I get an error in Unity.

		int[,] array = new int[3, 3] { { 1, 4, 2 }, { 4, 5, 1 }, { 7, 3, 8 } };

		int[,] sortedByFirstElement = array.OrderBy(x => x[0]);
		int[,] sortedBySecondElement = array.OrderBy(x => x[1]);
		int[,] sortedByThirdElement = array.OrderBy(x => x[2]);

When I run it I get error message CS0411 which says: “…Try specifying the type arguments explicitly”

How do I need to modify/change this so I can get it to work in Unity?

Thank you in advance.

You probably found this post and just like others which commented on that page you didn’t seem to read the post that was mentioned in that answer. The built-in linq extensions do not support multidimensional arrays. You have to write your own extension or use the one provided on the codeproject post.