using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.Linq; using System.Reflection; using System.Xml.Linq; class Program { static void Main(string[] args) { XDocument xml = new XDocument(new XDeclaration("1.0", "UTF-8", "yes"), new XElement("people", new XElement("idperson", new XAttribute("id", 1), new XAttribute("year", 2004), new XAttribute("salary", "100")))); System.IO.StringWriter sw = new System.IO.StringWriter(); xml.Save(sw); Console.WriteLine(sw); } }