Esempio n. 1
0
        public static int binaryLastIndexOf <valueType>(this valueType[] values, valueType value)
            where valueType : IComparable <valueType>
        {
            int index = binaryIndexOfThan(values, value, IComparableExtension <valueType> .CompareToHandle);

            return(index != 0 && IComparableExtension <valueType> .CompareToHandle(value, values[--index]) == 0 ? index : -1);
        }
Esempio n. 2
0
        public static int binaryIndexOf <valueType>(this valueType[] values, valueType value)
            where valueType : IComparable <valueType>
        {
            int index = binaryIndexOfLess(values, value, IComparableExtension <valueType> .CompareToHandle);

            return(index != values.Length && IComparableExtension <valueType> .CompareToHandle(value, values[index]) == 0 ? index : -1);
        }