⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch10_10.cs

📁 《c#技术内幕代码》
💻 CS
字号:
using System;
using System.Xml;

public class CH10_10
{
   public static void Main(string[] args)
   {
        // Create an XML writer.
        XmlTextWriter myXmlTextWriter = new XmlTextWriter ("ch10_10.xml", null);
	
        myXmlTextWriter.Formatting = Formatting.Indented;
        myXmlTextWriter.WriteStartDocument(false);
        myXmlTextWriter.WriteDocType("ch10_10", null, null, null);
        myXmlTextWriter.WriteComment("This file represents some user data");
	
        for ( int i=0; i<args.Length; ++i )
	{
           myXmlTextWriter.WriteStartElement(args[i]);
           myXmlTextWriter.WriteStartElement("entry", null);
              myXmlTextWriter.WriteAttribute("date","Today");
              myXmlTextWriter.WriteAttribute("reason","Because");
              myXmlTextWriter.WriteAttribute("ID", i.ToString());
           myXmlTextWriter.WriteEndElement();
	}
        // Commit the data
        myXmlTextWriter.Flush();
        myXmlTextWriter.Close();
   }
}
   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -