Exemplo n.º 1
0
 public static void Sort <T, TList, TComparer>(TList list, int startIndex, int length, TComparer comparer) where TList : IList <T> where TComparer : IComparer <T>
 {
     Validate.Begin().IsNotNullIfRefType <TList>(ref list, "list").IsNotNullIfRefType <TComparer>(ref comparer, "comparer").Check().IsNotNegative(startIndex, "startIndex").IsNotNegative(length, "length").IsRangeValid(list.Count, startIndex, length, "list").Check();
     if ((length != 0) && (length != 1))
     {
         AlgorithmsWithComparer <T, TList, TComparer> .IntrospectiveSort(list, startIndex, length, comparer);
     }
 }
Exemplo n.º 2
0
 public static int BinarySearch <T, TList, TComparer>(TList array, int index, int count, T item, TComparer comparer) where TList : IList <T> where TComparer : IComparer <T> =>
 AlgorithmsWithComparer <T, TList, TComparer> .InternalBinarySearch(array, index, count, item, comparer);
Exemplo n.º 3
0
 public static int BinarySearch <T>(IList <T> array, int index, int count, T item, Comparison <T> comparer) =>
 AlgorithmsWithComparer <T, IList <T>, ComparisonWrapper <T> > .InternalBinarySearch(array, index, count, item, new ComparisonWrapper <T>(comparer));
Exemplo n.º 4
0
 public static int BinarySearch <T>(IList <T> array, int index, int count, T item, IComparer <T> comparer) =>
 AlgorithmsWithComparer <T, IList <T>, IComparer <T> > .InternalBinarySearch(array, index, count, item, comparer);
Exemplo n.º 5
0
 public static int BinarySearch <T, TList>(TList array, T item) where TList : IList <T> =>
 AlgorithmsWithComparer <T, TList, Comparer <T> > .InternalBinarySearch(array, 0, array.Count, item, Comparer <T> .Default);
Exemplo n.º 6
0
 public static int BinarySearch <T>(IList <T> array, T item) =>
 AlgorithmsWithComparer <T, IList <T>, Comparer <T> > .InternalBinarySearch(array, 0, array.Count, item, Comparer <T> .Default);