SortedList<'TKey, 'TValue>.IndexOfKey Method ('TKey)


Searches for the specified key and returns the zero-based index within the entire SortedList<'TKey, 'TValue>.

Namespace:   System.Collections.Generic
Assembly:  System (in System.dll)

member IndexOfKey : 
        key:'TKey -> int


Type: TKey

The key to locate in the SortedList<'TKey, 'TValue>.

Return Value

Type: System.Int32

The zero-based index of key within the entire SortedList<'TKey, 'TValue>, if found; otherwise, -1.

Exception Condition

key is null.

This method performs a binary search; therefore, this method is an O(log n) operation, where n is Count.

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Return to top