good morning.
i have a jagged array declared like
int[][][] tmpA = new int[INT_WORKING_SIZE * 2][][];
I trying to sort this array with this code:
Array.Sort(tmpA, 0, INT_WORKING_SIZE*2, new MyArrayComparer());
and my class:
public int Compare(object x,object y)
{
if (x == null || y == null)
return 0;
int[][] arrayA = (int[][])x;
int[][] arrayB = (int[][])y;
int resultA = arrayA[1].Sum();
int resultB = arrayB[1].Sum();
return resultA.CompareTo(resultB);
}
each row of jagged array has 2 arrays with 12 ints.
I want to sort the array by adding all the 12 ints of the second array and the smallest should be first.
However my major problem is that object x,y are often nulls and the sorted array gets all zeros.
any tips?