C# 读取配置文件(指定路径)的方法
c#读取配置文件。
ExeConfigurationFileMap map = new ExeConfigurationFileMap();
map.ExeConfigFilename = @"E:\site.config"; ;
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
string connstr = config.ConnectionStrings.ConnectionStrings["connStr"].ConnectionString;
MessageBox.Show(connstr);
string key = config.AppSettings.Settings["key"].Value;
MessageBox.Show(key);
您可能感兴趣的文章:
C# 读取配置文件(指定路径)的方法
python使用pandas处理excel的方法
Go语言从入门到精通 -【web项目实战篇】- 读取配置文件
有关c#操作目录-文件-字符串的类
file.getPath() getAbsolutePath() getCanonicalPath()区别
jquery.cookie() 方法的使用(读取、写入、删除)
构建可配置PHP应用程序的正确方式
Mac 下使用 clion 调试 PHP 内核源码
asp.net C#获取DLL、程序路径,C#获取桌面、收藏夹等特殊系统路径
jquery.cookie用法详细解析