suppose I have
public class A
{
public List<AContents;
}
public class B: A
{
public string nameB;
}
public class C:A
{
public string nameA;
}
and I want to deserialise something like
<?xml?>
<A>
<Name>fred</Name>
<Contents>
<B>
<NameB>bert</NameB>
<Contents>
<A>
<Name>allison</Name>
</Contents>
</A>
<B>
<NameB>jim</NameB>
<Contents>..</Contents>
</Contents>
<A>
In short I want to represent a tree with polymorphic nodes.
I can do this (I think) if I accept that my nodes will read <A
xsi:type="B">, but this will be relatively unreadable. It's possible that I
can do this by overriding IXmlSerializable but I'm not sure if it will handle
deserialization with the inherited types.
I'm sure I can do this by using XmlReader and writing my own parser, but
that's not really the point of this Xml stuff, is it?
Any help or pointers much appreciated!
Iain