Can different datasets with different fieldnames be de-serialized into a class?
[
XmlRoot(ElementName ="P")]publicclassP
{
privatestring _P1;
privatestring _P2;
[XmlElement(ElementName ="P1")]
[XmlElement(ElementName ="L1")]
publicstring P1
{
get {return _P1; }
set { _P1 =value; }
}
[XmlElement(ElementName ="P2")]
[XmlElement(ElementName ="L2")]
publicstring P2
{
get {return _P2; }
set { _P2 =value; }
}
}
below is the xml:
<P>
<P1>text</P1>
<P2>text</P2>
</P>
<P>
<L1>text</L1>
<L2>text</L2>
</P>
When I try to de-serialize the xml, it gives me "There was an error reflecting type". What will be the best way to do this. I am able to deserialize the if I have a single xmlelement. I want to be able to searilize class and de-serialize xml into class.
Please advice,
shrini

