码迷,mamicode.com
首页 > Windows程序 > 详细

C#读取指定路径下的Config配置文件

时间:2016-08-11 10:04:37      阅读:449      评论:0      收藏:0      [点我收藏+]

标签:

ExeConfigurationFileMap map = new ExeConfigurationFileMap();
            map.ExeConfigFilename = @"F:\App1.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#读取指定路径下的Config配置文件

标签:

原文地址:http://www.cnblogs.com/a849788087/p/5759611.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!