Summary
Performs a binary search on the specified collection.
Syntax
public static int BinarySearch<TItem>(this IList<TItem> list, TItem value, IComparer<TItem> comparer)
Type Parameters
Name |
Description |
TItem |
The type of the item. |
Parameters
Name |
Type |
Description |
list |
IList<TItem> |
The list to be searched. |
value |
TItem |
The value to search for. |
comparer |
IComparer<TItem> |
The comparer that is used to compare the value with the list items. |
Return Value
Type |
Description |
int |
The index of the specified value in the specified array, if value is found; otherwise, a negative number. |