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

  • 相关阅读:
    mac重启nginx时报nginx.pid不存在的解决办法
    js 正则表达式
    js 闭包
    js yarn
    js npm
    vue3 vite
    node 错误处理
    node fs
    linux包管理工具使用和区别(转)
    MySQL数据库学习----理论基础
  • 原文地址:https://www.cnblogs.com/wyxy2005/p/1871623.html
Copyright © 2011-2022 走看看