Summary
- Namespace
- Avalonia
.Collections .Pooled - Containing Type
- PooledList
<T>
Syntax
public int BinarySearch(int index, int count, T item, IComparer<T> comparer)
Remarks
Elements of the list are compared to the search value using the given IComparer interface. If comparer is null, elements of the list are compared to the search value using the IComparable interface, which in that case must be implemented by all elements of the list and the given search value. This method assumes that the given section of the list is already sorted; if this is not the case, the result will be incorrect.
The method returns the index of the given value in the list. If the list does not contain the given value, the method returns a negative integer. The bitwise complement operator (~) can be applied to a negative result to produce the index of the first element (if any) that is larger than the given search value. This is also the index at which the search value should be inserted into the list in order for the list to remain sorted.
Parameters
Return Value
Type | Description |
---|---|
int |