如何使用LINQ,C#向元素添加属性? [英] How to add attributes to an element using LINQ, C#?
本文介绍了如何使用LINQ,C#向元素添加属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个XElement对象,它具有许多属性,我只是想向元素添加另一个属性.
I have an XElement object which has a number of attributes and I simply want to add another attribute to the element.
我该怎么做?
推荐答案
xElement.Add(new XAttribute("Foo", "Bar"));
这篇关于如何使用LINQ,C#向元素添加属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文