We should remove the comparer-builder overloads for BinarySearch (for both T[] and List<T>).
Reasoning:
BinarySearch only works on sorted collections. The standard use case is to use the same comparer for Sort and then BinarySearch, in which case using the comparer-builder overloads would require code duplication.
The BinarySearch comparer may be a "widening" comparer for that used in the Sort. This is the only realistic use case for BinarySearch comparer-builder overloads. E.g., list.Sort(c => c.OrderBy(x => x.LastName).ThenBy(x => x.FirstName)) followed by list.BinarySearch(c => c.OrderBy(x => x.LastName)). In this case, the stricter Sort comparer is compatible with the wider BinarySearch comparer. IMO, this is insufficiently common to warrant the overloads.
Sort is useful on its own, so it should keep the comparer-builder overloads.
We should remove the comparer-builder overloads for
BinarySearch
(for bothT[]
andList<T>
).Reasoning:
BinarySearch
only works on sorted collections. The standard use case is to use the same comparer forSort
and thenBinarySearch
, in which case using the comparer-builder overloads would require code duplication.BinarySearch
comparer may be a "widening" comparer for that used in theSort
. This is the only realistic use case forBinarySearch
comparer-builder overloads. E.g.,list.Sort(c => c.OrderBy(x => x.LastName).ThenBy(x => x.FirstName))
followed bylist.BinarySearch(c => c.OrderBy(x => x.LastName))
. In this case, the stricterSort
comparer is compatible with the widerBinarySearch
comparer. IMO, this is insufficiently common to warrant the overloads.Sort
is useful on its own, so it should keep the comparer-builder overloads.