How to remove all child nodes of an XmlElement, but keep all attributes?

后端 未结 3 384
情话喂你
情话喂你 2021-01-07 23:00

How to remove all child nodes of an XmlElement, but keep all attributes?

Note, that XmlElement.RemoveAll also removes all attributes. What is a clean, e

3条回答
  •  清酒与你
    2021-01-07 23:27

    Would this solution not be simpler?

    while(e.FirstChild != null)
        e.RemoveChild(e.FirstChild);
    

提交回复
热议问题