I don’t think this is possible at all - with the .NET ConfigurationManager class, as far as I know, it’s not even possible to open any file you want — you are limited to the app.config file. Reading configuration data from a source other than a file? No.
You can either parse the XML-String yourself (using "XmlDocument.LoadXml (string)"), or modify the app.config file and read it again.
: CustomSection? (, , ). , CustomSection?
XML , :
XmlDocument appconfig = new XmlDocument();
appconfig.Load("[config_filename]");
XmlNode root = appconfig.DocumentElement;
XmlDocument mysection = new XmlDocument();
mysection.LoadXml([SectionData]);
XmlNode customSection = mysection.DocumentElement;
XmlNode tempNode = appconfig.ImportNode(customSection, true);
root.AppendChild(tempNode);
appconfig.Save("[config_filename]");
...
var mySectionObj = ConfigurationManager.GetSection("myCustomSection");
, :
:
, : .config, .
( , , , , ).
, - , , : .
-:
XML- XmlDocument: XmlDocument.LoadXml(xmlstring)
xmldocument "doc.ChildNodes" "doc.SelectNodes(xpath)" "doc.SelectSingleNode(xpath)".
, , , , . .