Reputation: 954
I have a problem. I want to set and get a variable in my App.xaml.cs, so I use this code:
static User user { get; set; }
public static User User
{
get
{
if(user == null)
{
user = new User();
}
return user;
}
set
{
User = value;
}
}
And inside a page I call this line:
App.User = response.user;
But after that line is fired, the app doesn't hit the next line and after a few seconds the app crashes. What am I doing wrong?
Upvotes: 0
Views: 207
Reputation: 89204
this causes an infinite loop
set
{
User = value;
}
you should be doing
set
{
user = value;
}
Upvotes: 1