首页 > 代码库 > 读取app.config配置文件信息

读取app.config配置文件信息

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <appSettings>
        <add key="dbInfo" value=http://www.mamicode.com/"Student" />
    </appSettings>
</configuration>
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            string str = System.Configuration.ConfigurationSettings.AppSettings["dbInfo"].ToString();
            MessageBox.Show(str);
        }
    }
}

读取app.config配置文件信息