System::Array::BinarySearch method

Array::BinarySearch(System::ArrayPtr<T>, const T&) method

Performs binary search in the sorted array.

static int System::Array<T>::BinarySearch(System::ArrayPtr<T> arr, const T &item)
ParameterTypeDescription
arrSystem::ArrayPtr<T>Sorted array to perform search in
itemconst T&An item to search for

ReturnValue

Index of the searched item if one is found, otherwise, a negative integer that is the bitwise complement of the index of the next item greater than searched item or, if there is no greater item, the bitwise complement of the number of elements in the array.

See Also

Array::BinarySearch(System::ArrayPtr<T>, const Y&, const SharedPtr<Collections::Generic::IComparer<Z>>&) method

NOT IMPLEMENTED.

template<typename Y,typename Z> static int System::Array<T>::BinarySearch(System::ArrayPtr<T> arr, const Y &item, const SharedPtr<Collections::Generic::IComparer<Z>> &comparer)

See Also