maztt
maztt

Reputation: 12294

asp.net mvc setting XElement xml to empty

How can I do something like XElement xml =empty;

Upvotes: 0

Views: 360

Answers (1)

Darren Lewis
Darren Lewis

Reputation: 8488

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");

Upvotes: 1

Related Questions