Feature Request: Access PropertyChanged listeners in PropertyChangedBase

Jul 21, 2011 at 1:51 AM

Some of my VM's that inherit from PropertyChangedBase have a clone method. To save time and make it more maintainable I use MemberwiseClone for the initial copy. BUT usually I dont want to copy the event subscribers.

It would be nice to have a protected method where I could get all the subscribed PropertyChanged delegates.

I could imagine that this might break encapsulation, but I wonder what your thoughts are?


Jul 30, 2011 at 12:26 AM
Edited Jul 30, 2011 at 12:27 AM

If I remember correclty you are not allowed to access the source delegates held by the event (unless you use reflection, perhaps); hence I'm assuming that you can't just get them from PropertyChangedBase.PropertyChanged event.
You might consider inheriting PropertyChangedBase, reimplementing INPC interface explicitly in the subclass.
In the event add/remove implementation you can collect delegates instances just before hooking them to the base PropertyChanged event.

Does it make sense?