I'm developing a winforms application which has a login and I'd like to keep track of the state (i.e. Logged In or Logged Out). I've seen other answers on SO like this one decrying the use of public or global variables like this:
public static bool LoggedIn;
private void btnLogin_Click(object sender, EventArgs e)
{
//do some stuff
LoggedIn = true;
}
So what is the best way to track a User State or other variables for a program? They should be accessible program wide. Thanks a lot!