Possible Duplicate:
Best way to get InnerXml of an XElement?
I am using an XElement to hold a block of HTML serverside.
I would like to convert the children of that XElement into a string, sort of like an "InnerHtml" property does in javascript.
Can someone help me on this please? :)
The other answers will work if the element only contains other elements. If you want to include text as well, you'll want to use Nodes() instead of Elements():
var result = string.Concat(element.Nodes());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With