读取App.config
1.添加引用 System.Configuration.dll
2.using System.Configuration;
3.ConfigurationManager.AppSettings[key]
<!-- xml -->
<appSettings>
<add key="ref" value="1" />
<add key="dll" value="2" />
</appSettings>
var dll = ConfigurationManager.AppSettings["dll"];//1
var @ref = ConfigurationManager.AppSettings["ref"];//2
读取数据库连接字符串
var str = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;