У меня есть следующее свойство:
private List<Game> gamesList;
public List<Game> GamesList
{
get
{
return this.gamesList;
}
set
{
this.SetValue(ref this.gamesList, value); // NotifyPropertyChanged
}
}
SetValue:
public class BaseViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void SetValue<T>(ref T backingfield, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(backingfield, value))
{
return;
}
else
{
backingfield = value;
this.OnPropertyChanged(propertyName);
}
}
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
И я хочу сделать это:
StreamReader sr = new StreamReader(response);
var dbResponse = sr.ReadToEnd();
sr.Close();
this.GamesList = JsonConvert.DeserializeObject<List<Game>>(dbResponse);
Это вызывает исключение в Getter of GamesList, и я не знаю, что его вызывает. Данные, которые я получаю от dbReponse, верны.
-