- 
      
 - 
        
Save anonymous/cdf5f4148953a64d39dc to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class Demo : INotifyPropertyChanged | |
| { | |
| protected void SetValue<T>(T value, ref T container, [CallerMemberName] string propertyName = "") | |
| { | |
| if (value.Equals(container)) | |
| return; | |
| container = value; | |
| OnPropertyChanged(propertyName); | |
| } | |
| public event PropertyChangedEventHandler PropertyChanged; | |
| private void OnPropertyChanged(string propertyName) | |
| { | |
| var pc = PropertyChanged; | |
| if (pc != null) | |
| pc.Invoke(this, new PropertyChangedEventArgs(propertyName)); | |
| } | |
| } | |
| public class ConcreteDemo : Demo | |
| { | |
| private string _value; | |
| public string Value | |
| { | |
| get { return _value; } | |
| set { SetValue(value, ref _value); } | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment