| BinarySearchT(IListT, T) |
Searches the entire sorted IListT for an element
and returns the zero-based index of the element.
If the key is not found, a negative number is returned,
which can be intepreted as the bitwise complement
of the interval of indices that the key is in between, i.e.
|
| BinarySearchT(IListT, FuncT, Int32) |
Searches the entire sorted IListT for an element using the provided
comparer and returns the zero-based index of the element.
This differs from the "ordinary" binary search in allowing a comparer delegate that defines whether an item is found (returning 0), whether the item in the list is before (<0) or after (>0) that knows how to compare a class with its key. Example, if the list contains classes of type T having an id number and the class is sorted on that id, then the keySelector returns the id number for that class. Example
If having a list of doubles, to find 4.5 in the list, use:
int index = list.BinarySearch(d => d.CompareTo(4.5))
|
| BinarySearchT(IListT, T, IComparerT) |
Searches the entire sorted IListT for an element using the provided
comparer and returns the zero-based index of the element.
If the key is not found, a negative number is returned,
which can be intepreted as the bitwise complement
of the interval of indices that the key is in between, i.e.
|
| BinarySearchT, TKey(IListT, FuncT, TKey, TKey) |
Searches the entire sorted IListT for an element
and returns the zero-based index of the element.
If the key is not found, a negative number is returned,
which can be intepreted as the bitwise complement
of the interval of indices that the key is in between, i.e.
This differs from the "ordinary" binary search in allowing a keySelectorcomparer that knows how to compare a class with its key. Example, if the list contains classes of type T having an id number and the class is sorted on that id, then the keySelector returns the id number for that class. |
| BinarySearchT, TKey(ListT, FuncT, TKey, TKey) |
Searches the entire sorted IListT for an element
and returns the zero-based index of the element.
If the key is not found, a negative number is returned,
which can be intepreted as the bitwise complement
of the interval of indices that the key is in between, i.e.
This differs from the "ordinary" binary search in allowing a keySelectorcomparer that knows how to compare a class with its key. Example, if the list contains classes of type T having an id number and the class is sorted on that id, then the keySelector returns the id number for that class. |
| BinarySearchT, TKey(IListT, FuncT, TKey, TKey, IComparerTKey) |
Searches the entire sorted IListT for an element using the provided
comparer and returns the zero-based index of the element.
If the key is not found, a negative number is returned,
which can be intepreted as the bitwise complement
of the interval of indices that the key is in between, i.e.
This differs from the "ordinary" binary search in allowing a keySelectorcomparer that knows how to compare a class with its key. Example, if the list contains classes of type T having an id number and the class is sorted on that id, then the keySelector returns the id number for that class. |
| BinarySearchT, TKey(ListT, FuncT, TKey, TKey, IComparerTKey) |
Searches the entire sorted IListT for an element using the provided
comparer and returns the zero-based index of the element.
If the key is not found, a negative number is returned,
which can be intepreted as the bitwise complement
of the interval of indices that the key is in between, i.e.
This differs from the "ordinary" binary search in allowing a keySelectorcomparer that knows how to compare a class with its key. Example, if the list contains classes of type T having an id number and the class is sorted on that id, then the keySelector returns the id number for that class. |