views:

45

answers:

1

What is the difference between XmlArrayAttribute and XmlArrayItemAttribute? Please explain both sides (i.e. serialzing and deserialzing).

+1  A: 

A short answer - with the XmlArrayAttribute you change how the whole collection is serialized (so e.g. what is the name of the xml tag that will contain the entries), and with XmlArrayItemAttribute you control every item. Really good examples are here: http://msdn.microsoft.com/en-us/library/2baksw0z.aspx

Grzenio
My issue is that I have created a root class and a child class. The root class has a public property that is of type List<ChildClass>. When I try to deserialize with no attribute, the List<ChildClass> is not populated. When I apply the XmlArrayAttribute to the List<ChildClass>, it is still not populated. When I apply the XmlArrayItemAttribute it is populated. I am wondering why the one works and the other does not.
Mike Cheel
Could you please paste (to your question) your class and an example xml?
Grzenio