Collection Events?
I was wondering if there is a way to monitor a collection (eg StringCollection) for changes.
Back in the Delphi world, there was a class called TStringList, which was essentially the same thing, and it had an OnChanged event, which enabled you to listen for changes to the list.
I think a Change event in the standard collection classes would be immensely helpful - or is there already a collection class with a Change event that I haven't found?
If no such animal exists ... would it be worth petitioning to have an event added to the base collection classes for a future release?
Cheers,
mabster
[611 byte] By [
mabster] at [2007-12-16]
I agree it would be handy to add a Changed event on Collection.
However, it wouldn't be too hard to derive from Collection<T> and override the ClearItems, InsertItem, RemoveItem and SetItem methods to raise a Changed event.
Possibly. I'm just using a collection to keep track of most recently used files. I wanted to catch the change event so I could update my File menu.
I'll check it out. Thanks.