.net 2.0中的Linq to XML [英] Linq to XML in .net 2.0

查看:114
本文介绍了.net 2.0中的Linq to XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在.net 2.0中使用Linq到XML?我不确定,如果没有,我该如何重新编码

IS there a way to use Linq to XML in .net 2.0? I'm not sure about it, if not, how could i recode this

var doc = XDocument.Load("config.xml");
var xVideo = doc
               .Element("XML")
               .Element("VIDEO");
xVideo.SetElementValue("MAPTEXTURELEVEL", 8);
doc.Save("config.xml");

是否不使用Linq to XML?

Without using Linq to XML?

推荐答案

XmlDocument doc = new XmlDocument();
doc.Load("config.xml");    
XmlNode node = doc.SelectSingleNode("/XML/VIDEO/MAPTEXTURELEVEL[1]");
node.InnerText = "8";
doc.Save("config.xml");

不,您不能在.net 2.0中使用XDocument

No, you can't use XDocument in .net 2.0

这篇关于.net 2.0中的Linq to XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆