Witam
Spotkałam się z taką konstrukcją, w której przy seterze każdego pola wywoływany jest NotifyPropertyChanged.
public string CustomerName
{
get
{
return this.customerNameValue;
}
set
{
if (value != this.customerNameValue)
{
this.customerNameValue = value;
NotifyPropertyChanged("CustomerName");
}
}
}
public string PhoneNumber
{
get
{
return this.phoneNumberValue;
}
set
{
if (value != this.phoneNumberValue)
{
this.phoneNumberValue = value;
NotifyPropertyChanged("PhoneNumber");
}
}
}
Nie wygląda to komicznie gdy klasa ma 2 pola. Co jednak gdy ma 20 albo 50 pól? Czy każde pole musi być w taki sposób oprogramowane???