On Updating app.config file comments are getting removed RRS feed

  • Question

  • Hi All,

    I am updating my app.config file from my code and in order to give description about keys present in app.config, i wrote comments about each of the key.

    Comments are geeting removed on updating app.config.

    Is there any chance to retain the comments. Pls help me on this

    Below is the code to update app.config


    _appConfig.AppSettings.Settings[strKey].Value = newValue;



    _appConfig = ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.BaseDirectory +"Demo.dll"); ConfigurationSaveMode.Full);  
    Monday, April 12, 2010 10:41 AM


  • You will probably have to parse the config file via XML parser yourself.


    • Marked as answer by eryang Monday, April 19, 2010 12:54 AM
    Monday, April 12, 2010 8:23 PM