Hi,
does anyone know if I can have an XmlArray with two unrelated
XmlArrayItem,
i.e. where the items are not child-parent related?
I tried this, but I get an exception when creating the XmlSerializer.
[XmlArray("customers"), XmlArrayItem("names"),
XmlArrayItem("ids")]
(The classes of type "names" and "ids" are not related.)
Thanks for any insight!
barnum@bluezone.no - 30 May 2008 13:19 GMT
On 30 Mai, 14:06, bar...@bluezone.no wrote:
> Hi,
>
[quoted text clipped - 8 lines]
>
> Thanks for any insight!
Oooops, the code line above is not correct. But my question is still
valid: "can I have an XmlArray with two unrelated XmlArrayItems, i.e.
where the items are not child-parent related?".
Marc Gravell - 30 May 2008 14:26 GMT
You should just be able to declare multiple [XmlArrayItem] entries; what
error are you getting? Alternatively, you can actually do the same thing
with the [XmlElement] that accepts a Type:
[XmlElementAttribute("FOO", typeof(Foo))]
[XmlElementAttribute("BAR", typeof(Bar))]
public List<object> Items
{
get
{
return this.itemsField;
}
}
Marc