Mega Code Archive

 
Categories / C# / XML LINQ
 

XElement Save serializes this element to a file

using System; using System.IO; using System.Linq; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; public class MainClass {     public static void Main()     {         XElement root = new XElement("Root",             new XElement("Child", "child content")         );         root.Save("Root.xml");         string str = File.ReadAllText("Root.xml");         Console.WriteLine(str);     } }