I noticed that XElement is a class, so I tried something like:
var doc = new XDocument(
new XDeclaration("1.0", "utf8", "yes"),
new XElement("Root")
);
var root = doc.Root;
var com = new XElement("Component", new XAttribute("name", "arm"));
root.Add(com);
root.Add(com);
root.Add(com);
com.Add(new XAttribute("type", 1));
Console.WriteLine(doc);
but the output is:
<Root>
<Component name="arm" type="1" />
<Component name="arm" />
<Component name="arm" />
</Root>
I also tried SetAttributeValue(), and got the same result.
Why is the type attribute only attached to the first component?
