Sorry, got it slightly wrong, if you want a collection element and need to
name it differently use
[XmlArray("MyXmlCollectionName")]
Then, for the the items you can have multiple XmlArrayItem values e.g.
[XmlArrayItem("Person"), typeof(Resource)]
[XmlArrayItem("Manager"), 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("Person"), 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******@nospam.cix.co.uk> wrote in message
news:e8**************@TK2MSFTNGP10.phx.gbl...
Found it, you just omit the XmlArray attribute i.e.
/// <summary>
/// Property Resources (EntityCollection)
/// </summary>
[XmlArrayItem("Resource", typeof(Entity))]
public EntityCollection Resources
{
get { return resources; }
set { resources = value; }
}
"Paul Hatcher" <ph******@nospam.cix.co.uk> wrote in message
news:eI**************@TK2MSFTNGP12.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