I'm having trouble on deserializing xml node which has xsi:type attribute. Part of the code:
[XmlElement("ValueObject")]
public object ValueObject {
get
{...
}
set
{...
}
}
after serialization
The value could be serialized fine(pictured), but when it was deserialized the ValueObject has no type information but System.Xml.XmlNode[3].
This was on .net fx 4.0, C#
Any ideas why?
Thanks,
You have not sent your code, but I would guess that you had not indicated the list of possible derived types, when creating the XmlSerializer. Here is an example that makes use of DateTime and float, as derived types of object, for Value:
The XML produced and consumed by this code is: