Tag: callermembername

实现INotifyPropertyChanged时,比替代方法慢吗?

有很好的文章提出了实现INotifyPropertyChanged不同方法 。 考虑下面的基本实现: class BasicClass : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private void FirePropertyChanged(string propertyName) { var handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } private int sampleIntField; public int SampleIntProperty { get { return sampleIntField; } set { if (value != sampleIntField) { sampleIntField = value; FirePropertyChanged("SampleIntProperty"); // ouch ! […]