如果我需要通过调用以下方法在我的属性中设置一些数据:
private List<string> _country = GetCountries();
public List<string> Country
{
get
{
return _country ;
}
set
{
_country = value;
OnPropertyChanged("Country");
}
}
现在如果我们使用Fody,那么上面的私有变量将被移除,并且将使用[ImplementPropertyChanged]。如下所示。
public List<string> Country {get;Set;}
上面GetCountries()如何调用将数据设置为属性?