For example, I have an array of floating point numbers:
float[] numbers = new float[] { 1, 34, 65, 23, 56, 8, 5, 3, 234 };
If I use:
Array.Sort(numbers);
Then the array is sorted by the size of the number.
I want to sort the numbers by another criteria, so element A should go before element B if f(A) < f(B), rather than the usual of A < B.
So, for example, If I want to sort them according to there value modulo 5. The array would become:
5, 65, 1, 56, 3, 8, 23, 34, 234
I think it can be done through LINQ, but I'm not sure how.