Implementing INotifyPropertyChanged - does a better way exist?

前端 未结 30 3195
感情败类
感情败类 2020-11-21 05:23

Microsoft should have implemented something snappy for INotifyPropertyChanged, like in the automatic properties, just specify {get; set; notify;} I

30条回答
  •  萌比男神i
    2020-11-21 05:49

    There's also Fody which has a PropertyChanged add-in, which lets you write this:

    [ImplementPropertyChanged]
    public class Person 
    {        
        public string GivenNames { get; set; }
        public string FamilyName { get; set; }
    }
    

    ...and at compile time injects property changed notifications.

提交回复
热议问题