Chili.Opf3 Send comments on this topic.
BinarySearch(T) Method
See Also 
Chili.Opf3 Namespace > Generic ObjectSet Class > BinarySearch Method : BinarySearch(T) Method




item
The object to locate. The value can be null for reference types.
Searches the entire sorted ObjectSet for an element using the default comparer and returns the zero-based index of the element.

Syntax

Visual Basic (Declaration) 
Overloads Public Function BinarySearch( _
   ByVal item As T _
) As Integer
Visual Basic (Usage)Copy Code
Dim instance As ObjectSet(Of T)
Dim item As T
Dim value As Integer
 
value = instance.BinarySearch(item)
C# 
public int BinarySearch( 
   T item
)
Managed Extensions for C++ 
public: int BinarySearch( 
   T item
) 
C++/CLI 
public:
int BinarySearch( 
   T item
) 

Parameters

item
The object to locate. The value can be null for reference types.

Return Value

The zero-based index of item in the sorted ObjectSet, if item is found; otherwise, a negative number, which 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.

Exceptions

ExceptionDescription
InvalidOperationExceptionThe default comparer cannot find an IComparable implementation of the Type T.

Requirements

Platforms: Windows 2000, Windows XP family, Windows Server 2003 family, Windows Vista family

See Also