ObservableCollection<T>.OnCollectionChanged 方法

定義

使用提供的引數,引發 CollectionChanged 事件。

protected:
 virtual void OnCollectionChanged(System::Collections::Specialized::NotifyCollectionChangedEventArgs ^ e);
protected virtual void OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e);
abstract member OnCollectionChanged : System.Collections.Specialized.NotifyCollectionChangedEventArgs -> unit
override this.OnCollectionChanged : System.Collections.Specialized.NotifyCollectionChangedEventArgs -> unit
Protected Overridable Sub OnCollectionChanged (e As NotifyCollectionChangedEventArgs)

參數

e
NotifyCollectionChangedEventArgs

所引發事件的引數。

範例

覆寫此方法時,請呼叫基底實作或使用 BlockReentrancy 方法來處理重新進入集合變更,如下列範例所示:

using (BlockReentrancy())
{
    // OnCollectionChanged call
}
Using BlockReentrancy()
    ' OnCollectionChanged call
End Using

備註

修改這個集合的屬性和方法會透過這個virtual方法引發 CollectionChanged 事件。

適用於