Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
OnGet Method

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
[C#]
protected virtual object OnGet(
 object key,
 object currentValue
);
[C++]
protected: virtual Object* OnGet(
 Object* key,
 Object* currentValue
);
[JScript]
protected function OnGet(
   key : Object,
 currentValue : Object
) : Object;

Parameters

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

Return Value

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

Remarks

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.

Requirements

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

Show:
© 2015 Microsoft