I have a string like this: "<Root><Child>Hey</Child></Root>"
How can I convert this to an XElement
Object?
var el = new XElement("name", value);
The XElement class is one of the fundamental classes in LINQ to XML. It represents an XML element. The following list shows what you can use this class for: Create elements. Change the content of the element.
Use XElement.Parse method like below
XElement xmlTree = XElement.Parse("<Root><Child>Hey</Child></Root>"); Console.WriteLine(xmlTree);
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