How to remove all child nodes of an XmlElement, but keep all attributes?
XmlElement
Note, that XmlElement.RemoveAll also removes all attributes. What is a clean, e
For a truly efficient solution:
e.IsEmpty = true;
is your fastest and simplest option. It does exactly what you requested: all inner text and nested elements are discarded, while attributes are retained.