系统学习笔记

来源:互联网 发布:安卓好用的壁纸软件 编辑:程序博客网 时间:2024/06/06 02:59

#region 的用法

#region  此处是折叠后显示的名字

、、、

代码

、、、

#endregion 


1.获得当前路径

string %%1=Environment.CurrentDirectory; 


2.读取XML数据


//using System.Xml;XmlDocument doc=new XmlDocument();doc.Load(%%1);string %%9;XmlElement xe=doc.GetElementById(%%7);XmlNodeList elemList=xe.ChildNodes;foreach(XmlNode elem in elemList){if(elem.NodeType==%%8){%%9=elem.Value;break;}} 


3.写入XML数据

//using System.Xml;XmlDocument doc=new XmlDocument();doc.Load(%%1);XmlNode root=doc.DocumentElement;XmlElement book=doc.createElement_x_x(%%3);XmlElement book=doc.createElement_x_x(%%5);XmlElement port=doc.createElement_x_x(%%6);book.SetAttribute(%%4,root.ChildNodes.Count.ToString());author.InnerText=%%8;book.a(author);book.a(port);root.a(book);doc.Save(%%1); 

4. as 和 is 

as:返回的对象或者null

is:返回bool类型





0 0
原创粉丝点击