//ConfigurationManager.RefreshSection("appSettings");
string settingValue = ConfigurationManager.AppSettings.Get("setting1");
string settingValue = ConfigurationManager.AppSettings.Get("setting1");
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
string settingValue = config.AppSettings.Settings["setting1"].Value;
string settingValue = config.AppSettings.Settings["setting1"].Value;
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["setting1"].Value = "123";
config.Save(ConfigurationSaveMode.Modified);
config.AppSettings.Settings["setting1"].Value = "123";
config.Save(ConfigurationSaveMode.Modified);
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="setting1" value="123" />
</appSettings>
</configuration>
<configuration>
<appSettings>
<add key="setting1" value="123" />
</appSettings>
</configuration>
ConfigurationManager.AppSettings.Set("setting1", "123");