I have
public class Convolutions : List<Convolution> { }
Which serializes as xml:
<ArrayOfConvolution>
<Convolution>
But I would like:
<Convolutions>
<Convolution>
But it is not possible to use [XmlArray("Convolutions")] or [XmlElement(ElementName = "Convolutions")] on a class.
Anyway to acheive this?
If that is the root object, then:
If it is a member of another object, use attributes on the member.
Another approach, more flexible in many cases, is to use a separate wrapper object and encapsulate the list; frankly, inheriting from lists is not usually very helpful. The following would work:
or if you don’t like
seton your collection members: