zoukankan
html css js c++ java
App.Config 操作类
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Xml;
namespace
DataUpper
{
abstract
class
AppConfig
{
public
static
string
ReadConfig(
string
strXmlKey)
{
return
System.Configuration.ConfigurationManager.AppSettings[strXmlKey].ToString();
}
public
static
void
SaveConfig(
string
strXmlKey,
string
strXmlValue)
{
XmlDocument doc
=
new
XmlDocument();
string
strFileName
=
AppDomain.CurrentDomain.BaseDirectory.ToString()
+
"
DataUpper.exe.config
"
;
doc.Load(strFileName);
XmlNodeList nodes
=
doc.GetElementsByTagName(
"
add
"
);
for
(
int
i
=
0
; i
<
nodes.Count; i
++
)
{
XmlAttribute xmlAtt
=
nodes[i].Attributes[
"
key
"
];
if
(xmlAtt.Value
==
strXmlKey)
{
xmlAtt
=
nodes[i].Attributes[
"
value
"
];
xmlAtt.Value
=
strXmlValue;
break
;
}
}
doc.Save(strFileName);
}
}
}
查看全文
相关阅读:
kibana 安装和启动
Docker安装MariaDB-10.2
php 生成指定日期范围内的数组
linux nohup 命令
git的常用指令(一)
git的常用指令(二) git add -A 、git add . 和 git add -u
修改hosts文件 解决coursera可以登录但无法播放视频的问题
修改mac系统的host文件 (一)
charles 抓包 (二)
charles 抓包 (一)
原文地址:https://www.cnblogs.com/zhangpengshou/p/1345052.html
最新文章
Druid源码阅读之连接池
jdk8新特性(文章推荐)
JVM垃圾收集器整理
谈一谈synchronized关键词
责任链模式实现的三种方式
解析spring循环依赖策略
如何对HashMap按键值排序
OSGI系列一---环境搭建
java 开发项目管理工具
RSA密钥的生成与配置
热门文章
Maven 常用命令,手动创建第一个 Maven 项目
maven的常用命令
使用Nexus搭建Maven私服
Spring的IOC原理
js 转义 对象中的 双引号
go 生成UniqueId
go map 转json
nginx添加第三方模块
go基本数据类型--map
mongodb 已有文档添加字段
Copyright © 2011-2022 走看看