Automatic Properties and INotifyPropertyChanged RRS feed

  • General discussion

  • I was doing searches to determine if there was anything you could do with automatic properties beyond

    public int MyInt { get; set; }

    namely, just attach INotifyPropertyChanged support. It doesn't look like you can - and yes, I know doing so by hand is 'easy' and even easier with a snippet.
    ISerializable (or whatever compiler internals) provides the [OnDeserialized ()] attribute.

    INotifyPropertyChanged could provide a [OnSetNotifyPropertyChanged (PropertyChanged)] attribute. MyProp is simply your class's impl/decl of 

    #region INotifyPropertyChanged Members
    public event PropertyChangedEventHandler PropertyChanged;

    Then it's easy and foolproof.

    Dan Holt

    Tuesday, June 3, 2008 4:34 PM