I have a class which contains a list :
public class a
{
private List<MyType> _Children;
public Children
{
get { return(_Children); }
set { _Children = value ; }
}
}
I want to create an event and fire it whenever my list (_Children here) is changed for example an item is added to it or removed from it or it's cleared.
thanks
Change your list to an ObservableCollection<T>
. It implements INotifyCollectionChanged, so you can subscribe to change events on it.
Another option is to use BindingList<T>
, if you need full list semantics.
See ObservableCollection
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With