<p>I know it is a good idea to store configuration data in app.config (e.g. database connection strings) instead of hardcoing it, even if I am writing an application just for myself. But is there a way to update the configuration data stored in app.config from the program that is using it?</p>

[{'answer_id': 36332, 'author': 'Glenn Slaven', 'author_id': 2975, 'author_profile': 'https://Stackoverflow.com/users/2975', 'pm_score': 4, 'selected': True, 'text': '<p>If you use the Settings for the project, you can mark each setting as either application or user.</p>\n\n<p>If they\'re set as user, they will be stored per-user and when you call the Save method it will be updated in the config for that user.</p>\n\n<p>Code project has a really detailed <a href="http://www.codeproject.com/KB/dotnet/user_settings.aspx" rel="nofollow noreferrer">article</a> on saving all types of settings.</p>\n'}, {'answer_id': 36335, 'author': 'Domenic', 'author_id': 3191, 'author_profile': 'https://Stackoverflow.com/users/3191', 'pm_score': 1, 'selected': False, 'text': '<p>app.config isn\'t what you want to use for user-tweakable data, as it\'ll be stored somewhere in Program Files (which the user shouldn\'t have write permissions to). Instead, settings marked with <code>a UserScopedSettingAttribute</code> will end up in a user-scoped .config file somewhere in %LocalAppData%.</p>\n\n<p>I found the best way to learn this stuff was to mess with the Visual Studio "Settings" tab (on your project\'s property pages), then look at the code that it generates and look in %LocalAppData% to see the file that it generates.</p>\n'}]
['https://Stackoverflow.com/questions/36326', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3205/']