Answers for "how to read values from app.config file in c#"

C#
0

.net framework get configuration value from web.config

ConfigurationManager.AppSettings["MySetting"]
Posted by: Guest on November-06-2020
0

add settings to config file c#

//Must install package System.Configuration.ConfigurationManager
//APPLICATION CONFIG FILE
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="Key0" value="0" />
        <add key="Key1" value="1" />
        <add key="Key2" value="2" />
    </appSettings>
</configuration>

//CODE
using System.Configuration;
using System.Collections.Specialized;

//READ Value of Setting Key0
string sAttr = ConfigurationManager.AppSettings.Get("Key0");
Posted by: Guest on February-10-2021

C# Answers by Framework

Browse Popular Code Answers by Language