Get<>(dict, key, defaultVal) Get<>(dict, key, defaultVal) Get<>(dict, key1, key2, defaultVal) IndexOfSubarray<>(sourceArray, findWhat, startIndex, sourceLength, comparer) Insert<>(array, startIndex, values) Insert<>(array, startIndex, value) Remove<>(array, startIndex, length) SubarrayEquals<>(sourceArray, sourceStartIndex, otherArray, otherStartIndex, length, comparer)
Legend Class Struct Enum Interface Delegate | Constructor Method Property Event Field |
| Extension method: void BinarySearch<TK, TV>(this SortedList<TK, TV>, TK, out int, out int)Declarationpublic static void BinarySearch<TK, TV>(
this SortedList<TK, TV> list,
TK key,
out int index1,
out int index2
)Summary
Performs a binary search for the specified key on a SortedList<T1, T2>. When no match
exists, returns the nearest indices for interpolation/extrapolation purposes. Generic type parameters| TK | This type parameter is not documented. | | TV | This type parameter is not documented. |
Parameters| this SortedList<TK, TV> | list |
List to operate on. | | TK | key |
The key to look for. | | out int | index1 |
Receives the value of the first index (see remarks). | | out int | index2 |
Receives the value of the second index (see remarks). |
Remarks
If an exact match exists, index1 == index2 == the index of the match. If an exact match is not found, index1
< index2. If the key is less than every key in the list, index1 is int.MinValue and index2 is 0. If it's
greater than every key, index1 = last item index and index2 = int.MaxValue. Otherwise index1 and index2 are
the indices of the items that would surround the key were it present in the list. |