ProcessQueueTBinarySearch(Int32, Int32, T, IComparerT) Method
Searches a range of elements in the sorted
ProcessQueueT, using a binary search algorithm, for an
element using the specified comparer and returns the zero-based index of the element.
Namespace: Gemstone.Threading.CollectionsAssembly: Gemstone.Threading (in Gemstone.Threading.dll) Version: 1.0.141 -- Release Build+5e2ec463438f5de09767d41cb13e56e90c503d09
public virtual int BinarySearch(
int index,
int count,
T item,
IComparer<T> comparer
)
Public Overridable Function BinarySearch (
index As Integer,
count As Integer,
item As T,
comparer As IComparer(Of T)
) As Integer
public:
virtual int BinarySearch(
int index,
int count,
T item,
IComparer<T>^ comparer
)
function BinarySearch(index, count, item, comparer);
- index Int32
- The zero-based starting index of the range to search.
- count Int32
- The length of the range to search.
- item T
- The object to locate. The value can be null for reference types.
- comparer IComparerT
- The Generic.IComparer implementation to use when comparing elements -or- null to use
the default comparer: Generic.Comparer(Of T).Default
Int32
The zero-based index of item in the sorted
ProcessQueueT, 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.
ProcessQueueT must be sorted in order for this function to return an accurate result.
ArgumentOutOfRangeException | startIndex is outside the range of valid indexes for the ProcessQueueT
-or- count is less than 0 -or- startIndex and count do not specify a valid section in the ProcessQueueT |
InvalidOperationException | The default comparer, Generic.Comparer.Default, cannot find an
implementation of the IComparable generic interface or the IComparable interface for type T. |