.NET property changed sensitivity
I need to make a instance of some class to provide informations when it's property is being changed. Basically I am trying to implement a binding mechanism, which will watch the properties of the bound 开发者_如何转开发class and inform the system that the property has been changed.
The only solution I have found is to:
- Add an event PropertyChanged using Emit
- Get PropertyInfo
- Get SetMethod IntPtr
- Create new SetMethod using Emit which will encapsulate the old method and call the new Event
- Change SetMethod using the new one
Is there any other way? And if not, is there any example how to do this or is there any existing solution?
Thanks for an answer.
Is there any reason why you don't implement the INotifyPropertyChanged interface? I put together a quick sample in my answer to this question.
精彩评论