StateManagedCollection.OnValidate(Object) 方法

定义

在派生类中替代时,验证 StateManagedCollection 集合的一个元素。When overridden in a derived class, validates an element of the StateManagedCollection collection.

protected:
 virtual void OnValidate(System::Object ^ value);
protected virtual void OnValidate (object value);
abstract member OnValidate : obj -> unit
override this.OnValidate : obj -> unit
Protected Overridable Sub OnValidate (value As Object)

参数

value
Object

要验证的 IStateManagerThe IStateManager to validate.

例外

valuenullvalue is null.

注解

OnValidate调用方法来验证通过 StateManagedCollection 实现接口方法操作的对象 IListThe OnValidate method is called to validate the object manipulated through the StateManagedCollection implementation of the IList interface methods. 默认实现是验证集合操作的对象是否不是 null ; 但是,从派生的集合 StateManagedCollection 重写 OnValidate 方法以执行任何其他验证,如类型检查。The default implementation is to verify that the object manipulated by the collection is not null; however, collections derived from StateManagedCollection override the OnValidate method to perform any additional validation, such as type-checking.

适用于

另请参阅