Skip to content

Instantly share code, notes, and snippets.

@runceel
Last active June 21, 2019 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save runceel/8ce477e2c5661a20405f0c042262273f to your computer and use it in GitHub Desktop.
Save runceel/8ce477e2c5661a20405f0c042262273f to your computer and use it in GitHub Desktop.
public class BindableBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual bool SetProperty<T>(ref T field, T value, [CallerMemberName]string propertyName)
{
if (EqualityComparer<T>.Default.Equals(storage, value)) return false;
storage = value;
RaisePropertyChanged(propertyName);
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment