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);
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

可以找到 value 處之以零起始的索引。The 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.

適用於

另請參閱