Click or drag to resize
ArrayListBinarySearch Method (Object)
Searches the entire sorted ArrayList for an element using the default comparer and returns the zero-based index of the element.

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public virtual int BinarySearch(
	Object value
)

Parameters

value
Type: SystemObject
The Object to locate. The value can be null.

Return Value

Type: Int32
The zero-based index of value in the sorted ArrayList, if value is found; otherwise, a negative number, which is the bitwise complement of the index of the next element that is larger than value or, if there is no larger element, the bitwise complement of Count.
Exceptions
ExceptionCondition
ArgumentExceptionNeither value nor the elements of ArrayList implement the IComparable interface.
InvalidOperationExceptionvalue is not of the same type as the elements of the ArrayList.
See Also