gpt4 book ai didi

c# - 字符串到Xml的转换

转载 作者:太空宇宙 更新时间:2023-11-03 20:42:36 25 4
gpt4 key购买 nike

如何将下面的字符串转成xml?

 var query = @"<Cars><Car manufacturer='lindo'/>
<Car manufacturer='Opera'/></Cars>";

因为它是一个字符串,所以我无法应用扩展方法 .cast() 将其转换为 XDocument 或 XElement。

最佳答案

使用 XDocument.Parse方法。

关于c# - 字符串到Xml的转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1955318/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com