IDeserializationCallback in XMLSrializer
Is开发者_运维问答 there a way to utilize the IDeserializationCallback interface with the standard xmlSerializer? It does not appear to be supported in this context.
IDeserializationCallback works fine when used with the binary formatters.
Basicaly i want to do some calculation when de-serialization e.g.:
public void IDeserializationCallback.OnDeserialization(Object sender)
{
// After deserialization, calculate the age.
Age = System.DateTime.Now.Year - (DOB.Year + 1);
}
No, this interface is not used by the XmlSerializer.
Use IXmlSerializable
instead.
精彩评论