Serialize an array of objects as Xxxxs rather than ArrayOfXxxx
Posted
by Richard
on Stack Overflow
See other posts from Stack Overflow
or by Richard
Published on 2010-04-28T13:41:22Z
Indexed on
2010/04/28
13:43 UTC
Read the original article
Hit count: 266
I'm using ASP.NET MVC with XmlResult from MVCContrib.
I have an array of Xxxx objects, which I pass into XmlResult.
This gets serialized as:
<ArrayOfXxxx>
<Xxxx />
<Xxxx />
<ArrayOfXxxx>
I would like this to look like:
<Xxxxs>
<Xxxx />
<Xxxx />
<Xxxxs>
Is there a way to specify how a class gets serialized when it is part of array?
I'm already using XmlType to change the display name, is there something similar that lets you set its group name when in an array.
[XmlType(TypeName="Xxxx")] public class SomeClass
Or, will I need to add a wrapper class for this collection?
© Stack Overflow or respective owner