[]
        
(Showing Draft Content)

GrapeCity.Documents.Common.ReadOnlyStructList-1.BinarySearch

BinarySearch Method

BinarySearch(int, int, in T, StructComparison<T>)

Searches a range of elements in the sorted ReadOnlyStructList<T> for an element using the specified StructComparison<T> and returns the zero-based index of the element.

Declaration
public int BinarySearch(int index, int count, in T item, StructComparison<T> comparison)
Public Function BinarySearch(index As Integer, count As Integer, ByRef item As T, comparison As StructComparison(Of T)) As Integer
Parameters
Type Name Description
int index

The zero-based starting index of the range to search.

int count

The length of the range to search.

T item

The object to locate.

StructComparison<T> comparison

The StructComparison<T> to use when comparing elements.

Returns
Type Description
int

The zero-based index of item in the sorted ReadOnlyStructList<T>, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise complement of Count.

BinarySearch(int, int, in T, IStructComparer<T>)

Searches a range of elements in the sorted ReadOnlyStructList<T> for an element using the specified comparer and returns the zero-based index of the element.

Declaration
public int BinarySearch(int index, int count, in T item, IStructComparer<T> comparer)
Public Function BinarySearch(index As Integer, count As Integer, ByRef item As T, comparer As IStructComparer(Of T)) As Integer
Parameters
Type Name Description
int index

The zero-based starting index of the range to search.

int count

The length of the range to search.

T item

The object to locate.

IStructComparer<T> comparer

The IStructComparer<T> implementation to use when comparing elements.

Returns
Type Description
int

The zero-based index of item in the sorted ReadOnlyStructList<T>, if item is found; otherwise, a negative number that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, the bitwise complement of Count.