My C# application is executed and set a variable static "_user". Afterwords another application is executed under the same process and it must read that variable. I cannot obtain the expected results.
Application 1: Setting a _user variable:
public class Program { public static void Main(string[] args) { LoginDialog login = new LoginDialog(); login.RunDialog(); } }Class called by Application which set the variable _User
public class LoginDialog { private static string _user; public void RunDialog() { _user = "Peter"; } public static string User { get { return _user; } } }Application 2: Get static variable declared:
public class Program { public static void Main(string[] args) { string s = LoginDialog.User; } }