如何使用Fody在属性中设置逻辑

时间:2016-08-17 07:12:05

标签: mvvm fody-propertychanged

如果我需要通过调用以下方法在我的属性中设置一些数据:

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()如何调用将数据设置为属性?

0 个答案:

没有答案