C#交流俱乐部

学习为主,互相帮助

博客园 首页 新随笔 联系 订阅 管理

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

posted on 2010-11-08 11:44  bluce chen  阅读(283)  评论(0编辑  收藏  举报