CollectionBase.Clear 方法

定義

CollectionBase 執行個體移除所有的物件。Removes all objects from the CollectionBase instance. 無法覆寫這個方法。This method cannot be overridden.

public:
 virtual void Clear();
public void Clear ();
abstract member Clear : unit -> unit
override this.Clear : unit -> unit
Public Sub Clear ()

實作

備註

Count 設定為零。Count is set to zero.

這個方法是一項作業 O(n) ,其中 nCountThis method is an O(n) operation, where n is Count.

若要在清除集合之前或之後執行自訂動作,請覆寫受保護的 OnClearOnClearComplete 方法。To perform custom actions before or after the collection is cleared, override the protected OnClear or OnClearComplete method.

適用於