2
I wanted to know if it’s possible and, if so, how to trigger an event when a List
shall be amended as follows::
- An element is removed;
- An element is added;
- An element has its index changed;
Is there any way to trigger an event when it occurs?
2
I wanted to know if it’s possible and, if so, how to trigger an event when a List
shall be amended as follows::
Is there any way to trigger an event when it occurs?
3
Yes, but not using exactly List<>
. Use instead ObservableCollection<T>
.
Basically, the class has two events that do what you need, but you would only use CollectionChanged
for all three cases.
Another way would be to use dynamic proxy, but would be recommended only to intercept cases where the ObservableCollection
cannot act.
Browser other questions tagged c#
You are not signed in. Login or sign up in order to post.
How you change the element index?
– Jean Gustavo Prates
Use an Observablecollection.
– Caffé