CollectionBase.OnInsertComplete(Int32, Object) Method

Definition

Performs additional custom processes after inserting a new element into the CollectionBase instance.

protected:
 virtual void OnInsertComplete(int index, System::Object ^ value);
protected virtual void OnInsertComplete (int index, object value);
protected virtual void OnInsertComplete (int index, object? value);
abstract member OnInsertComplete : int * obj -> unit
override this.OnInsertComplete : int * obj -> unit
Protected Overridable Sub OnInsertComplete (index As Integer, value As Object)

Parameters

index
Int32

The zero-based index at which to insert value.

value
Object

The new value of the element at index.

Remarks

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

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 collection reverts back to its previous state if one of the following occurs:

  • The process fails.

  • This method is overridden to throw an exception.

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

Notes to Inheritors

This method allows implementers to define processes that must be performed after inserting the element into the underlying ArrayList. By defining this method, implementers can add functionality to inherited methods without having to override all other methods.

OnInsert(Int32, Object) is invoked before the standard Insert behavior, whereas OnInsertComplete(Int32, Object) is invoked after the standard Insert behavior.

Applies to

See also