Reputation: 33
I have added my own section <section listeners>
in my app.config file.
How can I check, programmatically, if the new section exist?
Upvotes: 0
Views: 2230
Reputation: 311
You have to access it like a normal XML file.
var config = XDocument.Load("App.Config");
var element = config
.Element("section");
...
Upvotes: 0
Reputation: 13256
section = ConfigurationManager.GetSection("sectionName") as SectionType
section
will be null
if the section isn't there.
Upvotes: 2
Reputation: 3929
You might want to have a look at How to: Create Custom Configuration Sections Using ConfigurationSection
Upvotes: 0