Consider the following C# code:
[XmlRoot]
public class A
{
[XmlArray]
public List<B> ArrayOfBItems { get;set; }
}
public class B
{
[XmlAttribute]
public String Name { get;set; }
}
When run through XmlSerialzier, will produce the following:
<A>
<B Name="Foo" />
<B Name="Bar" />
</A>
What can I do, short of renaming class B to change the name that is output in XML? Adding XmlAttribute to a class is not allowed.
If you change the xml decoration from XmlArray to XmlElement, you should get your expected result.