3 回答

TA贡献1934条经验 获得超2个赞
对我来说,单线解决方案效果很好
XDocument y = XDocument.Parse(pXmldoc.OuterXml); // where pXmldoc is of type XMLDocument

TA贡献1818条经验 获得超7个赞
using System.Xml;
using System.Xml.Linq;
#region Extention Method
public static XElement ToXElement(this XmlElement element)
{
return XElement.Parse(element.OuterXml);
}
public static XmlElement ToXmlElement(this XElement element)
{
var doc = new XmlDocument();
doc.LoadXml(element.ToString());
return doc.DocumentElement;
}
#endregion
而不是简单地使用这样的扩展来使用此扩展
System.Xml.XmlElement systemXml = (new XElement("nothing")).ToXmlElement();
System.Xml.Linq.XElement linqXml = systemXml.ToXElement();
- 3 回答
- 0 关注
- 645 浏览
相关问题推荐
添加回答
举报