views:

130

answers:

3

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

And if there isn't what would be the appropriate interface for that? INotifyPropertyChanged seems not to be a very good fit for collections, while INotifyCollectionChanged is again only supported in .NET 3 and higher.

+11  A: 

BindingList<T>

Romain Verdier
Ah, thanks. That thing has eluded me so far.
Joey
+2  A: 

The Collection<T> exposes virtual InsertItem, RemoveItem, SetItem and ClearItems methods that you could override and add your own events triggers to.

(Just a possible alternative to the BindingList<T>)

Simon P Stevens
A: 

All of the collections in the C5 Generic Collection Library are designed to be able to raise events when an item is added, inserted, removed, or when the collection is cleared or otherwise changed. It provides a more robust interface for dealing with these changes than being held strictly to a list of objects, but also works with dictionaries, hash tables, priority queues, persistently sorted lists, etc.

Marcus Griep