zoukankan      html  css  js  c++  java
  • 一段简单加载配置文件的代码

    public Setting()

    {

                string dirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Config");
                string[] filePaths = Directory.GetFiles(dirPath, "Database.*config");
                if (filePaths != null || filePaths.Length > 0)
                {
                    foreach (string path in filePaths)
                    {
                        Load(path);
                    }

                }

     }

    private void Load(string Path)
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(Path);

                XmlNodeList nodes = doc.DocumentElement.SelectNodes("Name");
                foreach (XmlElement elem in nodes)
                {
                   string key=elem.GetAttribute("key");
                }
            } 

  • 相关阅读:
    wtforms 钩子函数
    sqlalchemy 单表增删改查
    sqlalchemy 数据库操作
    flask wtforms组件
    python----------文件操作
    编码 编码的转化
    集合、深浅copy
    字典
    sort 、sorted、range、join方法 数字的正序、倒叙、翻转
    for循环
  • 原文地址:https://www.cnblogs.com/wyxy2005/p/1871623.html
Copyright © 2011-2022 走看看