Saving settings to app.config for C# winforms app

Follow the following stackoverflow question:

http://stackoverflow.com/questions/30572923/read-all-key-values-from-app-config-c-sharp

Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);

config.AppSettings.Settings.Remove("MySetting");
config.AppSettings.Settings.Add("MySetting", "some value");

config.Save(ConfigurationSaveMode.Modified);