Is there a <T> list in .NET 2 that raises events when the list changes?

I have used ObservableCollection<T> in the past, but it seems to belong to WPF and therefore .NET 3.

And if not, what would be the right interface for this? INotifyPropertyChanged does not seem to be very suitable for collections, and INotifyCollectionChanged again only supported in .NET 3 and later.

+4
source share
3 answers

Collection <T> provides the virtual methods InsertItem, RemoveItem, SetItem and ClearItems, which you can override and add your own event triggers.

(Possible alternative to BindingList <T>)

+2
source

All collections in the C5 Generic Collection Library are designed to raise events when an item is added, inserted, deleted, or when the collection is cleared or otherwise changed. It provides a more reliable interface for working with these changes than strictly adheres to the list of objects, but also works with dictionaries, hash tables, priority queues, constantly sorted lists, etc.

0
source

All Articles