How to edit application configuration settings? App.config best way to go?

前端 未结 9 773
攒了一身酷
攒了一身酷 2021-01-04 05:23

For my project I have settings that I added through the Settings in the project properties.

I quickly discovered that editing the app.config file directly seems to

9条回答
  •  半阙折子戏
    2021-01-04 05:45

     System.Configuration.Configuration config =ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
    
            config.AppSettings.Settings["oldPlace"].Value = "3";     
            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");
    

    Try with this code , is easy.

    Atte: Erick Siliezar

提交回复
热议问题