Mega Code Archive

 
Categories / C# / XML LINQ
 

XElement Load loads an XElement from a file

using System; using System.Linq; using System.Xml.Linq; using System.Collections; using System.Collections.Generic; public class MainClass{    public static void Main(){         XElement xmlTree1 = new XElement("Root",             new XElement("Child", "content")         );         xmlTree1.Save("Tree.xml");                  XElement xmlTree2 = XElement.Load("Tree.xml");         Console.WriteLine(xmlTree2.Name);     } }