score:1

Accepted answer

You need to concatenate the nodes inside the XElement, like this:

node.Nodes().Aggregate(new StringBuilder(), (sb, n) => sb.Append(n.ToString())).ToString()

Or, in .Net 4.0:

String.Concat(node.Nodes())

score:2

Alternatively:

using System.Xml.XPath;

string xml = node.CreateNavigator().InnerXml;

Related Articles