Returns the index of the specified key in the SortedList.
[Visual Basic] Overridable Public Function IndexOfKey( _ ByVal key As Object _ ) As Integer [C#] public virtual int IndexOfKey( object key ); [C++] public: virtual int IndexOfKey( Object* key ); [JScript] public function IndexOfKey( key : Object ) : int;
The index of key, if key is found in the SortedList; otherwise,-1.
Exception Type | Condition |
---|---|
ArgumentNullException | key is a null reference (in Visual Basic Nothing). |
This method can be overridden by a derived class.
This method uses a binary search algorithm; therefore, the average execution time is proportional to Log2 (size), where size is the size of the SortedList.
SortedList Class | SortedList Members | System.Collections Namespace | ContainsKey | IndexOfValue