.NET Framework Class Library  

DictionaryBase.OnValidate Method

Performs additional custom processes when validating the element with the specified key and value.

[Visual Basic]
Protected Overridable Sub OnValidate( _
   ByVal key As Object, _
   ByVal value As Object _
)
[C#]
protected virtual void OnValidate(
   object key,
   object value
);
[C++]
protected: virtual void OnValidate(
   Object* key,
   Object* value
);
[JScript]
protected function OnValidate(
   key : Object,
   value : Object
);

Parameters

key
The key of the element to validate.
value
The value of the element to validate.

Remarks

The default implementation of this method is intended to be overridden by a derived class to perform some action when the specified element is validated.

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 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.

OnValidate can be used to impose restrictions on the type of objects that are accepted into the collection. The default implementation prevents a null reference (Nothing in Visual Basic) from being added to or removed from the underlying System.Collections.Hashtable.

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 | OnSet | OnInsert