I would like to know if it is possible to change the element name of the generic list when serializing the following class.
[Serializable, XmlRoot(ElementName= "MyFoo")]
public class Foo : List<Foo2>
{
#region Private Members
#endregion
#region Public Properties
#endregion
}
[Serializable, XmlRoot(ElementName="YourFoo")]
public class Foo2
{
}
The output is:
<MyFoo>
<Foo2/>
</MyFoo>
The desire output:
<MyFoo>
<YourFoo/>
</MyFoo>
Just change
XmlRootonFoo2toXmlTypeandElementNametoTypeName, like this: