0

I need to read/write to an exe.config file without knowing before-hand what settings the file has. I am using the AppSettingsSection class, but the Settings collection is empty when the exe.config actually contains about 20 user settings. Here is the code I am using to access the application settings

string path = @"C:\Projects\App1.exe";
Configuration config = ConfigurationManager.OpenExeConfiguration(path);
AppSettingsSection appSettingSection = config.AppSettings;

It gets the config but the appSettingSection.Settings is empty when it really should have about 20 items. Am I missing something or is this not possible?

BDevAcc
  • 1
  • 1
  • Does this answer your question? [AppSettings get value from .config file](https://stackoverflow.com/questions/10766654/appsettings-get-value-from-config-file) – AMA Feb 27 '20 at 21:59
  • @AMA No, because config.AppSettings is empty. And I also do not know the Keys before hand. – BDevAcc Feb 28 '20 at 16:30

0 Answers0