Created
September 16, 2017 08:43
-
-
Save tanitanin/9d4bf2c99d0b48b025e5e6a338b36b4b to your computer and use it in GitHub Desktop.
Observable class to notify event which property changes.
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 Observable : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged; | |
public void Set<T>(ref T target, T value, [CallerMemberName] string propertyName = null) | |
{ | |
if (target.Equals(value)) return; | |
target = value; | |
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment