mercredi 10 juillet 2019

Event trigger on property change

I am trying to write an analysis tool that compares and tracks data over time in your application.

My goal currently is to find a way to send a trigger to a manager, once the value of a tracked property changes.

This process of setting up tracked properties should be as simple as possible, in an ideal world without the need of changes on the actual property code-wise, like the INotifyPropertyChanged interface. Any property with a valid getter&setter should be trackable.

My idea was to use Reflection to hook into the setter method of the property, and add a callback there once the setter is called.

Is there a better way to go about this? Or can reflection manage this, and if yes, how?





Aucun commentaire:

Enregistrer un commentaire