Sorry, got it slightly wrong, if you want a collection element and need to
name it differently use
[XmlArray("MyXml CollectionName" )]
Then, for the the items you can have multiple XmlArrayItem values e.g.
[XmlArrayItem("P erson"), typeof(Resource )]
[XmlArrayItem("M anager"), typeof(Manager)]
Note that all of the items have to be derived from the base class that
collection managers
If you *don't* want the collection element, then use
[XmlElement("Per son"), tyipeof(Person)]
I'm sure I've found this out before, but it's not that well documented on
MSDN.
Regards
Paul
"Paul Hatcher" <ph******@nospa m.cix.co.uk> wrote in message
news:e8******** ******@TK2MSFTN GP10.phx.gbl...
Found it, you just omit the XmlArray attribute i.e.
/// <summary>
/// Property Resources (EntityCollecti on)
/// </summary>
[XmlArrayItem("R esource", typeof(Entity))]
public EntityCollectio n Resources
{
get { return resources; }
set { resources = value; }
}
"Paul Hatcher" <ph******@nospa m.cix.co.uk> wrote in message
news:eI******** ******@TK2MSFTN GP12.phx.gbl... Is it possible to serialize a collection so that the collection itself
does not appear e.g.
<Document>
<Resource>
<name>a</name>
</Resource>
</Document>
rather than
<Document>
<Resources>
<Resource>
<name>a</name>
</Resource>
</Resources>
</Document>
I know I can do it if I have an array of items, but I'd prefer a
collection if at all possible
TIA
Paul