Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

After saving System.Configuration.Configuration, are changed

$
0
0

hi,

strange problem:

after caling the Save method all my <value> elements which previously were empty conatin a "\r\n". i changed my code in that way, that i just open and save the configuration file, but the values are still changed.
Can someone tell me why and how to avoid this?

System.Configuration.ExeConfigurationFileMap map = new System.Configuration.ExeConfigurationFileMap();
map.ExeConfigFilename = "app.config";

System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(map, System.Configuration.ConfigurationUserLevel.None);
config.Save(ConfigurationSaveMode.Modified, true);
app.config before:<MyApp.Properties.Settings><setting name="Setting" serializeAs="String"><value></value></setting></MyApp.Properties.Settings>


app.config after:

<MyApp.Properties.Settings><setting name="Setting" serializeAs="String"><value></value></setting></MyApp.Properties.Settings>



Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>