XElement xmlTree = new XElement("Barcodes",
new XElement("sample1 ", new XAttribute("ScanPegStatus", "aa")),
new XElement("sample2", new XAttribute("ScanPegStatus", "bb")),
new XElement("sample3", new XAttribute("ScanPegStatus", "cc"))
);XElement xmlTree2 = new XElement("Barcodes",
from el in xmlTree1.Elements()
where(el.Attributes["Id"]=='001' && (int)el.Attributes["sample"] == "333")
select el
);我没测试
你自己慢慢尝试下吧
new XElement("sample1 ", new XAttribute("ScanPegStatus", "aa")),
new XElement("sample2", new XAttribute("ScanPegStatus", "bb")),
new XElement("sample3", new XAttribute("ScanPegStatus", "cc"))
);XElement xmlTree2 = new XElement("Barcodes",
from el in xmlTree1.Elements()
where(el.Attributes["Id"]=='001' && (int)el.Attributes["sample"] == "333")
select el
);我没测试
你自己慢慢尝试下吧
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货