Skip to content

Instantly share code, notes, and snippets.

@luiscubal
Created November 30, 2013 17:37
Show Gist options
  • Select an option

  • Save luiscubal/7721966 to your computer and use it in GitHub Desktop.

Select an option

Save luiscubal/7721966 to your computer and use it in GitHub Desktop.
Simple Person class (with and without INotifyPropertyChanged)
//Without events
class Person {
public string Name { get; set; }
}
//With events
class Person : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged;
string name;
public string Name
{
get { return name; }
set
{
if (name != value) {
name = value;
RaisePropertyChanged("Name");
}
}
}
void RaisePropertyChanged(string propertyName) {
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment