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)

Declaration

public 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

TKThis type parameter is not documented.
TVThis type parameter is not documented.

Parameters

this SortedList<TK, TV>list List to operate on.
TKkey The key to look for.
out intindex1 Receives the value of the first index (see remarks).
out intindex2 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.