Ответ 1
Используйте XElement.Parse, как показано ниже
XElement xmlTree = XElement.Parse("<Root><Child>Hey</Child></Root>");
Console.WriteLine(xmlTree);
У меня есть строка вроде этого: "<Root><Child>Hey</Child></Root>"
Как я могу преобразовать это в объект XElement
?
Используйте XElement.Parse, как показано ниже
XElement xmlTree = XElement.Parse("<Root><Child>Hey</Child></Root>");
Console.WriteLine(xmlTree);