I\'ve stored configuration of my application in the app.config, by Visual Studio I\'ve created some application key on the settings tab of project properties dialog, then I\
I did a some tests and here is result.
For auto generated class Settings
the call of ConfigurationManager.RefreshSection("applicationSettings");
doesn't apply the modified values for members marked with ApplicationScopedSettingAttribute
, it applies the changes to future calls via ConfigurationManager
members (and not sure about UserScopedSettingAttribute
).
Instead call Settings.Default.Reload();
You need to make a call to ConfigurationManager.RefreshSection in order to have the values re-read from disk.
Aleroot's code for updating values worked fine. In spite of Properties.Settings being write only (no set).
To refresh, this worked for me: ConfigurationManager.RefreshSection("applicationSettings");
But I'm using this to access the parameter: string test = Properties.Settings.Default.MyString; MessageBox.Show("Paramètres/Settings MyString = " + test);
What you want is accomplish able by creating an custom ConfigSection which allows you more control and allows you to change the name. Configuration manager has a refresh section which will allow you reload the data.