using System;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
XmlElement child = doc.CreateElement("Child");
child.InnerText = "child contents";
XmlElement root = doc.CreateElement("Root");
root.AppendChild(child);
doc.AppendChild(root);
using (XmlNodeReader nodeReader = new XmlNodeReader(doc))
{
nodeReader.MoveToContent();
XElement xRoot = XElement.Load(nodeReader);
Console.WriteLine(xRoot);
}
}
}