Overload List

  Name Description
Public method BinarySearch(T)
Performs a binary search using IComparable. If the value occurs multiple times, there is no guarantee as to which index will be returned. If the value does not occur at all, the bitwise complement of the first index containing a larger value is returned (or the bitwise complement of the size of the queue if the value is larger than any value in the queue). This is the location at which the value should be inserted to preserve sort order. If the list is not sorted according to the appropriate IComparable implementation before this method is calling, the result is not guaranteed. The value passed in must implement IComparable, unless it is null. The IComparable.CompareTo method will be called on the value passed in, with the values in the queue as parameters, rather than the other way round. No test is made to make sure that the types of item are the same - it is up to the implementation of IComparable to throw an exception if incomparable types are presented. A null reference is treated as being less than any item, (so passing in null will always return 0 or -1). The implementation of IComparable is never asked to compare to null.
Public method BinarySearch(T, IComparer<(Of <<'(T>)>>))
Performs a binary search using the specified IComparer. If the value occurs multiple times, there is no guarantee as to which index will be returned. If the value does not occur at all, the bitwise complement of the first index containing a larger value is returned (or the bitwise complement of the size of the queue if the value is larger than any value in the queue). This is the location at which the value should be inserted to preserve sort order. If the list is not sorted according to the appropriate IComparer implementation before this method is calling, the result is not guaranteed. The CompareTo method will be called on the comparer passed in, with the specified value as the first parameter, and values in the queue as the second parameter, rather than the other way round. While a null reference should be treated as being less than any object in most implementations of IComparer, this is not required by this method. Any null references (whether in the queue or the specified value itself) are passed directly to the CompareTo method. This allow for IComparers to reverse the usual order, if required.
Public method BinarySearch(T, Comparison<(Of <<'(T>)>>))
Performs a binary search using the specified Comparison. If the value occurs multiple times, there is no guarantee as to which index will be returned. If the value does not occur at all, the bitwise complement of the first index containing a larger value is returned (or the bitwise complement of the size of the queue if the value is larger than any value in the queue). This is the location at which the value should be inserted to preserve sort order. If the list is not sorted according to the appropriate IComparer implementation before this method is calling, the result is not guaranteed. The CompareTo method will be called on the comparer passed in, with the specified value as the first parameter, and values in the queue as the second parameter, rather than the other way round. While a null reference should be treated as being less than any object in most implementations of IComparer, this is not required by this method. Any null references (whether in the queue or the specified value itself) are passed directly to the CompareTo method. This allow for Comparisons to reverse the usual order, if required.

See Also