CollectionBase.OnRemoveComplete(Int32, Object) Method


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

 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)



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


要从 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 属性返回的实例上调用,而不是在 InnerList 属性返回的实例上调用。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.

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

Notes to Inheritors

此方法允许实现者定义从基础 ArrayList中删除元素后必须执行的过程。This 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.

Applies to

See also