System.Collections.CollectionBase.OnClear Method

Performs additional custom processes when clearing the contents of the CollectionBase instance.

Syntax

protected virtual void OnClear ()

Remarks

The default implementation of this method is intended to be overridden by a derived class to perform some action before the collection is cleared.

The On* methods are invoked only on the instance returned by the CollectionBase.List property, but not on the instance returned by the CollectionBase.InnerList property.

If the process fails, the collection reverts back to its previous state.

The default implementation of this method is an O(1) operation.

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0