So I have this c# code that does a great job at parsing the following XML into an array:
var doc = XDocument.Load(path).Root
.Elements()
.Select(y => y.Elements().ToDictionary(x => x.Name, x => x.Value))
.ToArray();
XML:
<?xml version="1.0" encoding="utf-8" ?>
<bbb>
<a>
<x>green</x>
<y>4</y>
<z>3</z>
</a>
</bbb>
but I instead want to be able to write the XML like
<a x="green" y="4" z="3" />
How should I change the C# so that it ends up with the same result?
Try this: