如何从字符串转换为 XElement 对象 [英] How to convert from string to XElement object
本文介绍了如何从字符串转换为 XElement 对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的字符串:"
I have a string like this: "<Root><Child>Hey</Child></Root>"
如何将其转换为 XElement
对象?
How can I convert this to an XElement
Object?
推荐答案
使用 XElement.Parse 方法如下
XElement xmlTree = XElement.Parse("<Root><Child>Hey</Child></Root>");
Console.WriteLine(xmlTree);
这篇关于如何从字符串转换为 XElement 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文