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的方法
有关c#操作目录-文件-字符串的类
file.getPath() getAbsolutePath() getCanonicalPath()区别
构建可配置PHP应用程序的正确方式
jquery.cookie() 方法的使用(读取、写入、删除)
Mac 下使用 clion 调试 PHP 内核源码
ASP FileSystem 对象
asp.net C#获取DLL、程序路径,C#获取桌面、收藏夹等特殊系统路径
C# Winform中获取文件路径的方法