0

How can I do something like XElement xml =empty;

Jason Berkan
  • 8,734
  • 7
  • 29
  • 39
maztt
  • 12,278
  • 21
  • 78
  • 153

1 Answers1

1

Use the RemoveAll method to remove all child elements:

xml.RemoveAll();

This will leave you with your existing XElement as is but if you wanted to clear that out too just create a new XElement entirely.

xml = new XElement("name");
Darren Lewis
  • 8,338
  • 3
  • 35
  • 55