Storing Values in App.config

Storing values in the App.config file will allow others to update values without needing to access the source code and rebuilding the project. For example, when delivering a solution to another team which may need to change variables such as url, username or emails, then building the project with this in mind and retrieving values from App.config will allow them to easily make those changes.

  1. Add references and using statements to System.Configuration
  2. Add a key value pair to App.config
  3. Get the value with ConfigurationManager.AppSettings
  4. Edit the key value pair from the XML file MyApp.exe.config

On editing the config file, there will be no need to recompile the executable, but the values will be updated.

Add References

Using Configuration