c# - Refactoring PropertyChangedEventHandler -


In my UI code I have many sections with the same basic skeleton:

  • InotifyPropertyChanged
  • has the following code:

      Zero NotifyPropertyChanged (string information) {if (PropertyChanged! = Null) {PropertyChanged (New, This is New PropertyChangedEventArgs ( Info)); }} Private Event PropertyChangedEventHandler PropertyChanged;  

It seems that there is a right opportunity to create a factor in a class and get it from it instead of InnProperty, but sadly C # does not support multiple succession, so it's not really going to work, any ideas about how to reactify this kind of code?

Would you like to code this superclass to your superclass?

  • The object
    • Your concrete notification was changed to the category & lt; Insert here
      • Whatever your view inherited from Modable (and you stopped using many heritage
        • Your concrete viewload
        • Another concrete view MODEL

      Most MVVM frameworks provide such a category for you.

      Due to the rules of reaching around the events, you can not unfortunately cause it in an extension method without reflection.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -