手机
当前位置:查字典教程网 >编程开发 >C#教程 >C# 读取指定路径配置文件的方法
C# 读取指定路径配置文件的方法
摘要:复制代码代码如下:ExeConfigurationFileMapmap=newExeConfigurationFileMap();map.E...

复制代码 代码如下:

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# 读取指定路径配置文件的方法】相关文章:

c# 托盘双击不触发单击事件的实现方法

使用C#开发Socket通讯的方法

关于C#程序优化的五十种方法

C# 获取属性名的方法

WinForm中快捷键与组合按键的设置方法

C#使用DllImport调用非托管的代码的方法

C#词法分析器之词法分析的使用详解

关于c#中枚举类型支持显示中文的扩展说明

C#中HashTable的定义与使用方法

C# 写入XML文档三种方法详细介绍

精品推荐
分类导航