To read:
string value = ConfigurationManager.AppSettings["oldPlace"];
To modify/write:
System.Configuration.Configuration config =ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["oldPlace"].Value = "3";
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
More information can be retrieved from the MSDN:
http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.appsettings.aspx
No comments:
Post a Comment