C# 写配置文件
来源:互联网 发布:java 16进制中文 x 编辑:程序博客网 时间:2024/05/14 09:06
{
System.Xml.XmlDocument doc = new XmlDocument();
//获得配置文件的全路径
string filePath = AppDomain.CurrentDomain.BaseDirectory.ToString() + "PowerService.exe.config";
doc.Load(filePath);
System.Xml.XmlNodeList nodes = doc.GetElementsByTagName("add");
for (int i = 0; i < nodes.Count; i++)
{
//获得将当前元素的key属性
System.Xml.XmlAttribute att = nodes[i].Attributes["name"];
//根据元素的第一个属性来判断当前的元素是不是目标元素
if (att.Value == "SqlSystem_ConnString")
{
//对目标元素中的第二个属性赋值
att = nodes[i].Attributes["connectionString"];
att.Value = connString;
break;
}
}
doc.Save(filePath);
}
- C# 写配置文件
- C# 配置文件中写当前路径
- C# 写简单配置文件插件 SharpConfig 用法
- 写配置文件
- C# 配置文件
- Python写配置文件
- 写INI配置文件
- 如何写hibernate配置文件
- Lua写配置文件
- 自己写配置文件
- Inno Setup写配置文件
- QT写 读配置文件
- AOSP预写配置文件
- 配置文件路径如何写
- c# 数据库基础(将连接字符串写到配置文件中)
- c# 数据库基础(将连接字符串写到配置文件中)
- C#读写配置文件
- C#读取XML配置文件
- springmvc 定时器
- hdu 2853 Assignment(最大权值匹配)
- C#读写配置文件
- 百度地图不能定位自己的位置
- 高性能Web应用打造攻略:扩展过程中20个最大的绊脚石
- C# 写配置文件
- Watir-webdriver_ruby元素操作与定位
- 华师 操作系统实验 实验三
- Code Fragment-通过位运算来表达状态
- Linux c 多线程 互斥量
- c#中进行读写配置文件的方法
- android4.2 launcher加载模式--手机模式(phone),平板模式(tablet)
- 百度贴吧帖子图片批量下载工具
- wpf值转换器用法