Esempio n. 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);
     }
 }
Esempio n. 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);
     }
 }
Esempio n. 3
0
 public static void Sort(String[] array, IComparer <String> comparer)
 {
     SortUtil.MergeSort(array, comparer);
 }
Esempio n. 4
0
 public static void Sort <T>(T[] array, int from, int to, IComparer <T> comparer)
 {
     SortUtil.MergeSort(array, from, to, comparer);
 }