CollectionBase.OnRemoveComplete(Int32, Object) 方法

定义

在从 CollectionBase 实例中移除元素之后执行其他自定义进程。Performs additional custom processes after removing an element from the CollectionBase instance.

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

参数

index
Int32

从零开始的索引,可在该位置找到 valueThe zero-based index at which value can be found.

value
Object

要从 index 移除的元素的值。The value of the element to remove from index.

注解

此方法的默认实现旨在由派生类重写,以在删除指定元素后执行一些操作。The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified element is removed.

On * 方法仅在由属性返回的实例上调用 List ,而不是在由属性返回的实例上调用 InnerListThe 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.

此方法的默认实现是一种 O(1) 操作。The default implementation of this method is an O(1) operation.

继承者说明

此方法允许实现者定义从基础中删除元素后必须执行的进程 ArrayListThis method allows implementers to define processes that must be performed after removing the element from the underlying ArrayList. 通过定义此方法,实施者可以向继承的方法添加功能,而无需重写所有其他方法。By defining this method, implementers can add functionality to inherited methods without having to override all other methods.

OnRemove(Int32, Object) 在标准移除行为之前调用,而在 OnRemoveComplete(Int32, Object) 标准移除行为后调用。OnRemove(Int32, Object) is invoked before the standard Remove behavior, whereas OnRemoveComplete(Int32, Object) is invoked after the standard Remove behavior.

适用于

另请参阅