I ha开发者_StackOverflowve an XElement object which has a number of attributes and I simply want to add another attribute to the element.
How do I do this?
xElement.Add(new XAttribute("Foo", "Bar"));
To create an element with an attribute use:
var xmlTest = new XElement("XmlElementName", new XAttribute("XmlAttributeName", "AttributeValue"));
精彩评论