.Net2.0读取应用程序配置节
1
//方法一:加入名称空间:
2
using System.Configuration;
3
//然后
4
string strDbConn = new AppSettingsReader().GetValue("dbconn", typeof(string)).ToString();
5
//方法二:添加引用:(system.configuration)加入名称空间
6
using System.Configuration;
7 string strDbConn = ConfigurationManager.AppSettings["dbconn"];
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7 string strDbConn = ConfigurationManager.AppSettings["dbconn"];