书籍学习

c# 语言基础

c# 本质论

 

视频学习

2022最新C#10+.NET6零基础到精通已完结实战全集|全网首发(.Net Core/Sql/WP

20220524-17点开始-

视频学习,

1-工具下载安装

2-官方文档

 

简单xml的读取

XmlDocument doc = new XmlDocument();
            //简单xml的读取
                        doc.Load("/Users/shenshaonian/Desktop/new language/1.xml");
            XmlNodeList stuNodes = doc.DocumentElement.ChildNodes;
            foreach(XmlNode stuNode in stuNodes)
            {
                //Console.WriteLine(personNode.GetType());
                XmlElement stuEle = (XmlElement)stuNode;
                string stuId = stuEle.GetAttribute("StuID");
                XmlNode stuNameNode = stuEle.SelectSingleNode("StuName");
                string stuName = stuNameNode.InnerText;
                Console.WriteLine("stuId=" + stuId + " ,StuName=" + stuName);

            }

            Console.ReadKey();
<Person>
    <Student StuID = "11">
        <StuName>张三</StuName>
    </Student>
    <Student StuID = "22">
        <StuName>李四</StuName>
    </Student>
</Person>

简单xml的生成