I am trying to modify environmental variable using the below code.
Environment.SetEnvironmentVariable("MyEnv", "True");
In the same program in the next line, I am trying to retrive it.
string myEnv=Environment.GetEnvironmentVariable("MyEnv");
But I am getting the old value in the environment variable not the new value. Any pointers to the problem will be helpful. using c# and .Net4.0