G
Guest
When I try to deserialize a class that has an [XmlAnyElement] property, that
is getting assigned twice. Anyone else ever encounter this? Is this a .net
bug?
Sample code to reproduce:
// -------------------------------
// Deserialize my object...
MyItem q = MyItem.FromXml(
"<MyItem Name=\"Joe\"><Property Name=\"first\"/></MyItem>" );
// -------------------------------
public class MyItem
{
public MyItem() {}
[XmlAnyElement]
public XmlElement[] SerializationElements
{
get
{
return elements;
}
set
{
elements = value; // <<--THIS GETS CALLED TWICE
}
}
public static MyItem FromXml( string xml )
{
System.IO.StringReader reader = new System.IO.StringReader( xml );
return s.Deserialize( reader ) as MyItem;
}
private XmlElement[] elements = null;
private static XmlSerializer s = new XmlSerializer( typeof(MyItem) );
}
is getting assigned twice. Anyone else ever encounter this? Is this a .net
bug?
Sample code to reproduce:
// -------------------------------
// Deserialize my object...
MyItem q = MyItem.FromXml(
"<MyItem Name=\"Joe\"><Property Name=\"first\"/></MyItem>" );
// -------------------------------
public class MyItem
{
public MyItem() {}
[XmlAnyElement]
public XmlElement[] SerializationElements
{
get
{
return elements;
}
set
{
elements = value; // <<--THIS GETS CALLED TWICE
}
}
public static MyItem FromXml( string xml )
{
System.IO.StringReader reader = new System.IO.StringReader( xml );
return s.Deserialize( reader ) as MyItem;
}
private XmlElement[] elements = null;
private static XmlSerializer s = new XmlSerializer( typeof(MyItem) );
}