Skip to content

Instantly share code, notes, and snippets.

@Sa1Gur
Created August 16, 2019 23:41
Show Gist options
  • Save Sa1Gur/58449113e9eac599048cde6761f8740f to your computer and use it in GitHub Desktop.
Save Sa1Gur/58449113e9eac599048cde6761f8740f to your computer and use it in GitHub Desktop.
class TeamMateItem : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetPropertyValue<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(field, value)) return false;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
return true;
}
private string _name;
public string Name
{
get => _name;
set => SetPropertyValue(ref _name, value);
}
private uint _level;
public uint Level
{
get => _level;
set => SetPropertyValue(ref _level, value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment