Exemple #1
0
 public static void Sort(IList <String> list, IComparer <String> comparer)
 {
     if (list is List <String> )
     {
         SortUtil.MergeSort((List <String>)list, comparer);
     }
     else
     {
         IEnumerable <String> sorted = list.ToArray().OrderBy(x => x, comparer ?? new SortUtil.StringOrdinalComparator());
         list.Clear();
         list.AddAll(sorted);
     }
 }
Exemple #2
0
 public static void Sort <T>(IList <T> list, IComparer <T> comparer)
 {
     if (list is List <T> )
     {
         SortUtil.MergeSort((List <T>)list, comparer);
     }
     else
     {
         IEnumerable <T> sorted = list.ToArray().OrderBy(x => x, comparer ?? Comparer <T> .Default);
         list.Clear();
         list.AddAll(sorted);
     }
 }
Exemple #3
0
 public static void Sort(String[] array, IComparer <String> comparer)
 {
     SortUtil.MergeSort(array, comparer);
 }
Exemple #4
0
 public static void Sort <T>(T[] array, int from, int to, IComparer <T> comparer)
 {
     SortUtil.MergeSort(array, from, to, comparer);
 }