I have added my own section <section listen开发者_运维技巧ers>
in my app.config file.
How can I check, programmatically, if the new section exist?
section = ConfigurationManager.GetSection("sectionName") as SectionType
section
will be null
if the section isn't there.
You might want to have a look at How to: Create Custom Configuration Sections Using ConfigurationSection
You have to access it like a normal XML file.
var config = XDocument.Load("App.Config");
var element = config
.Element("section");
...
精彩评论