Ejemplo n.º 1
0
 /// <summary>
 /// Sort method which use delegate method for compare row elements
 /// </summary>
 /// <param name="array"></param>
 /// <param name="compareRows"></param>
 private static void SortByMethod(int[][] array, CompareRowsMethod compareRows)
 {
     for (int i = array.Length - 1; i > 0; i--)
     {
         for (int j = 0; j < i; j++)
         {
             if (compareRows(array[j], array[j + 1]) > 0)
             {
                 Swap(ref array[j], ref array[j + 1]);
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Sort jagged array using comparable method
 /// </summary>
 /// <param name="array">Array for sorting</param>
 /// <param name="compareRows">Method for compare inside arrays</param>
 public static void SortBy(int[][] array, CompareRowsMethod compareRows)
 {
     CheckArrayToNull(array);
     SortByMethod(array, compareRows);
 }