开发者

How to check the particular section or key word exist in appconfig file

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");
        ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜