问题
I have a string like this: "<Root><Child>Hey</Child></Root>"
How can I convert this to an XElement
Object?
回答1:
Use XElement.Parse method like below
XElement xmlTree = XElement.Parse("<Root><Child>Hey</Child></Root>");
Console.WriteLine(xmlTree);
来源:https://stackoverflow.com/questions/7847424/how-to-convert-from-string-to-xelement-object