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);
            }

        }

    }

  • 相关阅读:
    redis介绍以及安装
    解决Django Rest Framework中的跨域问题
    DRF之解析器组件及序列化组件
    DRF之REST规范介绍及View请求流程分析
    Vue汇总(搬砖)
    Django的Serializers的使用
    模板自定义标签和过滤器
    sencha touch 2.3.1 list emptyText不显示
    Cordova 3.3 开发环境搭建(视频)
    sencha touch 开发环境搭建(视频)
  • 原文地址:https://www.cnblogs.com/zhangpengshou/p/1345052.html
Copyright © 2011-2022 走看看