Skip to content

Instantly share code, notes, and snippets.

@hjerpbakk
Created July 23, 2012 20:09
Show Gist options
  • Save hjerpbakk/3165934 to your computer and use it in GitHub Desktop.
Save hjerpbakk/3165934 to your computer and use it in GitHub Desktop.
Save config after
var ConfigurationFileMap = new ExeConfigurationFileMap() { ExeConfigFilename = "My.config" };
var config = ConfigurationManager.OpenMappedExeConfiguration(ConfigurationFileMap, ConfigurationUserLevel.None);
if (config != null)
{
// do stuff
config.Save();
// Format XML
XDocument configXml = XDocument.Load(configuration.FilePath);
configXml.Save(configuration.FilePath, SaveOptions.None);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment