views:

17

answers:

2

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);
}
A: 

No, this interface is not used by the XmlSerializer.

John Saunders
A: 

Use IXmlSerializable instead.

Pent Ploompuu