c#XML数据查找

2024-04-23 18:23:56 浏览数 (1)

查找Version节点

代码语言:javascript复制
static void Main(string[] args)
        {
            XmlTextReader tReader = new XmlTextReader("..\..\StudentList.xml");
            string info = string.Empty;
            while (tReader.Read())
            {
                if (tReader.Name == "Version")
                {
                    info = "版本:"   tReader.GetAttribute("vNo");
                    break;
                }
            }
            Console.WriteLine(info);
         }

0 人点赞