I suggest you ...

INotifyPropertyChanged

Provide a way for INotifyPropertyChanged to be implemented for you automatically on class.

Provide a way for INPC to be done on auto properties (that you mark in some way)....so that you don't have to unroll the auto property into a field, and raise yourself.

2,638 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    jams shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    31 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Brett commented  ·   ·  Flag as inappropriate

        This is improved in VS11 net4.5 to use the method name optionally as [CallerMemberName] string PropertyName where the callername is subsitituted if no explicit name is supplied

      • Miha Markic commented  ·   ·  Flag as inappropriate

        Agree with Schuster-Rainer - AOP is the way to go. Roslyn might have this feature albeit I doubt it (due to the political decisions). As for now, there are AOP 3rd parties ranging from free ones (as RIchard pointed out) to much more powerful (not free, but well worthi it) PostSharp.
        The bottom line is that if MS is to add this feature it will be a part of Roslyn. And yes, I am totally in favor of such a feature.

      • apr commented  ·   ·  Flag as inappropriate

        This idea won't work for a winform/wpf(?) application, when the property is changed in a non-ui thread.

      • Qwertie commented  ·   ·  Flag as inappropriate

        I would only support this idea as part of a far more general metaprogramming feature. I imagine writing an auto-property like [FirePropertyChanged] int Foo {get;set;}, and then a compile-time FirePropertyChangedMetaAttribute(...) method would transform that into a property that fires PropertyChanged when called.

      • Schuster-Rainer commented  ·   ·  Flag as inappropriate

        Implement serverall compiler stages, or some kind of macros / AST transformation, or simply AOP, so this will be no problem anymore.

      • Alan Rotenberg commented  ·   ·  Flag as inappropriate

        Tangential to this but very related, it's kind of annoying to always have to test if an event is null before raising it. It's pretty tedious to always have to test of PropertyChanged is null. It should just do nothing if there are no subscribers.

      • Tuomas Hietanen commented  ·   ·  Flag as inappropriate

        It would be nice to have it like attribute to class, like [NotifyPropertyChange]

        However, events are actually just side effects (hard to test etc.), so I think that the whole event-driven software development model is bad. It seems to be the default model. :-(

      • Daver commented  ·   ·  Flag as inappropriate

        Most of the time, creating this INotifyPropertyChanged code is just mindless grunt work. It would be nice if it was assumed by convention to work a starndard way. And if you need it to behave non-standard, then allow it to be overridden somehow.

      • Daver commented  ·   ·  Flag as inappropriate

        Most of the time, creating this INotifyPropertyChanged code is just grunt work. It would be nice if it was assumed by convention to work a starndard way. And if you need it to behave non-standard, then allow it to be overridden somehow.

      • Anonymous commented  ·   ·  Flag as inappropriate

        Also add Raise feature like in VB and auto-event support with thread-safe raise implementation
        public event EventHandler ChangingEvent { add; remove; raise; }

      2 Next →

      Feedback and Knowledge Base