SortedList(Of TKey, TValue).IndexOfKey Method (TKey)


Searches for the specified key and returns the zero-based index within the entire SortedList(Of TKey, TValue).

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

Public Function IndexOfKey (
	key As TKey
) As Integer


Type: TKey

The key to locate in the SortedList(Of TKey, TValue).

Return Value

Type: System.Int32

The zero-based index of key within the entire SortedList(Of 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