ProcessQueueTBinarySearch(T, IComparerT) Method

Searches the entire sorted ProcessQueueT, using a binary search algorithm, for an element using the specified comparer and returns the zero-based index of the element.

Definition

Namespace: Gemstone.Threading.Collections
Assembly: Gemstone.Threading (in Gemstone.Threading.dll) Version: 1.0.128 -- Release Build+d4a9a653be1def5888b9be91bb1825c8655f3529
public virtual int BinarySearch(
	T item,
	IComparer<T> comparer
)

Parameters

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

Return Value

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.

Remarks

ProcessQueueT must be sorted in order for this function to return an accurate result.

Exceptions

InvalidOperationExceptionThe default comparer, Generic.Comparer.Default, cannot find an implementation of the IComparable generic interface or the IComparable interface for type T.

See Also