惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
博客园 - 司徒正美
L
LangChain Blog
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
Stack Overflow Blog
Stack Overflow Blog
Engineering at Meta
Engineering at Meta
U
Unit 42
Microsoft Azure Blog
Microsoft Azure Blog
I
InfoQ
博客园 - 叶小钗
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
月光博客
月光博客
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
D
DataBreaches.Net

博客园 - 蓝蓝的天2016

学习materialize VS2013 启用avalon 智能提示 Intelligence 推荐一款开源的C#TCP通讯框架 js/jquery 获取本地文件的文件路劲 获取input框中type=‘file’ 中的文件路径(转载) HTML5的 input:file上传类型控制(转载) tinymce4.x 上传本地图片 (转载) Jquery append()总结(一) 转载 Visual Studio各版本工程文件之间的转换 [转载] 创建数据库表(转载) 用IIS防止mdb数据库被下载(转载) 放映PPT幻灯片演示文稿如何让演讲者备注不投影到屏幕上(转载) C# MemoryCache 类[转载] 转载css3 图片圆形显示 如何CSS将正方形图片显示为圆形图片布局 微信 学习网址 winform 路径 CodeSimth - .Net Framework Data Provider 可能没有安装。解决方法[转载 ] 加载js代码 tinymce 上传图片空间(转) 页面跳转
操作App.config的类(转载)
蓝蓝的天2016 · 2016-07-27 · via 博客园 - 蓝蓝的天2016

http://www.cnblogs.com/yaojiji/archive/2007/12/17/1003191.html

操作App.config的类

public class DoConfig
    {
        public static void Editconfig(string Key,string Value)                       
        {
            XmlDocument xmldoc = new XmlDocument();
            string filePath = Application.ExecutablePath + ".config";
            xmldoc.Load(filePath);

            XmlNodeList topM = xmldoc.DocumentElement.ChildNodes;
            foreach (XmlElement element in topM)
            {
                if (element.Name.ToLower() == "appsettings")     //找到要改写的字段名  
                {
                    XmlNodeList _node = element.ChildNodes;
                    if (_node.Count > 0)
                    {
                        foreach (XmlElement el in _node)
                        {
                            //el.Attributes[Key].Value = Value;                                                                 //查找并改写  
                            if (el.Attributes["key"].Value == Key)
                                el.Attributes["value"].Value = Value;
                        }
                    }
                }
            }
            xmldoc.Save(filePath);       //保存改写文件  
        }
    }