开发者

How to read name-value attributes from an app.config file?

开发者 https://www.devze.com 2023-03-12 18:46 出处:网络
I am able to read the key-value attributes from the app.config file by using the following syntax. System.Configuration.ConfigurationManager.AppSettings[\"ConfigurationFile\"]

I am able to read the key-value attributes from the app.config file by using the following syntax.

System.Configuration.ConfigurationManager.AppSettings["ConfigurationFile"]

I want to read the name-value attributes from the app.config file which are defined under the following schema.

    <app开发者_运维问答licationsettings>
        <Host.Properties.Settings>
            <setting name="Path" serializeAs="String">
                <value>F:\PATH\</value>
            </setting>
        <Host.Properties.Settings>
    </applicationSettings>
</configuration>

What is the correct solution?


System.Configuration.ConfigurationManager.AppSettings["Path"]

or this:

Host.Properties.Settings.Default.Path

should work.

0

精彩评论

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