public int BinarySearch(T[] array, int index, int length, T value, IComparer <T> comparer) { try { if (comparer == null || comparer == Comparer <T> .Default) { return(GenericArraySortHelper <T> .BinarySearch(array, index, length, value)); } return(ArraySortHelper <T> .InternalBinarySearch(array, index, length, value, comparer)); } catch (Exception ex) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_IComparerFailed"), ex); } }