c# - Reading settings from app.config in .net 4.5 -



c# - Reading settings from app.config in .net 4.5 -

i've added reference system.configuration. i've created app1.config in project , populated next code:

class="lang-xml prettyprint-override"><?xml version="1.0" encoding="utf-8" ?> <configuration> <appsettings> <add key="resistancea" value="0.04"/> <add key="resistanceb" value="0.04"/> <add key="resistancec" value="0.01"/> <add key="tempbattlow" value="40"/> <add key="tempbatthigh" value="45"/> <add key="tempload" value="40"/> </appsettings> </configuration>

then seek read values using next code,

using system.configuration; string str = configurationmanager.appsettings.get("resistancea");

however not data. thought doing wrong? thanks.

make sure (app name here).config file appears in same folder (app name here).exe file. beingness called app1.config, i'm guessing have more one.

visual studio renames app.config actual (app name here).config file during build, not app1.config.

c# app-config

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -