CollectionBase.OnValidate Method (Object)
Performs additional custom processes when validating a value.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- value
-
Type:
System.Object
The object to validate.
| Exception | Condition |
|---|---|
| ArgumentNullException | value is null. |
The default implementation of this method determines whether value is null, and, if so, throws ArgumentNullException. It is intended to be overridden by a derived class to perform additional action when the specified element is validated.
The On* methods are invoked only on the instance returned by the List property, but not on the instance returned by the InnerList property.
The default implementation of this method is an O(1) operation.
Notes to Implementers:
This method allows implementers to define processes that must be performed when executing the standard behavior of the underlying System.Collections.ArrayList. 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 null from being added to or removed from the underlying System.Collections.ArrayList.
OnValidate is called prior to OnInsert, OnRemove, and OnSet.
Available since 10
.NET Framework
Available since 1.1