• xml


    using System.Xml.Linq;

    protected static string file = System.Web.HttpContext.Current.Server.MapPath("~/test/ruonanxiao.xml");
            public static string GetName()
            {
                string name = string.Empty;
                XElement doc = XElement.Load(file);
                var names = from p in doc.Descendants("name")
                            select p.Value;
                foreach (var n in names)
                {
                    name = n;
                }
                return name;
            }

            public static string GetSex()
            {
                string name = string.Empty;
                XElement doc = XElement.Load(file);
                var names = from p in doc.Descendants("sex")
                            select p.Value;
                foreach (var n in names)
                {
                    name = n;
                }
                return name;
            }

            public static string GetAge()
            {
                string name = string.Empty;
                XElement doc = XElement.Load(file);
                var names = from p in doc.Descendants("age")
                            select p.Value;
                foreach (var n in names)
                {
                    name = n;
                }
                return name;
            }

  • 相关阅读:
    Spring Cloud 企业云服务架构common-service代码分析
    Spring Cloud云服务架构代码结构构建
    配置环境真是复杂的事情
    一起来关注c11 吧!!!
    utubu
    今天开放了这个居然
    编译linux程序,unistd.h vc的处理
    postgres 设置密码
    提供各种开源软件编译服务的想法
    CSS基础
  • 原文地址:https://www.cnblogs.com/ruonanxiao/p/2439789.html
Copyright © 2020-2023  润新知