This documentation is archived and is not being maintained.

DictionaryBase.OnGet Method

Gets the element with the specified key and value in the DictionaryBase instance.

[Visual Basic]
Protected Overridable Function OnGet( _
   ByVal key As Object, _
   ByVal currentValue As Object _
) As Object
protected virtual object OnGet(
 object key,
 object currentValue
protected: virtual Object* OnGet(
 Object* key,
 Object* currentValue
protected function OnGet(
   key : Object,
 currentValue : Object
) : Object;


The key of the element to get.
The current value of the element associated with key.

Return Value

An Object containing the element with the specified key and value.


The default implementation of this method returns currentValue. It is intended to be overridden by a derived class to perform additional action when the specified element is retrieved.

The On* methods are invoked only on the instance returned by the Dictionary property, but not on the instance returned by the InnerHashtable property.

Notes to Implementers:  

This method allows implementers to define processes that must be performed when executing the standard Get behavior of the underlying System.Collections.Hashtable. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.

OnGet can be used to specify processes to perform before returning the value retrieved from the underlying System.Collections.Hashtable. For example, implementers can cast the value into another type before returning it.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DictionaryBase Class | DictionaryBase Members | System.Collections Namespace