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);
}
skaffman
  • 398,947
  • 96
  • 818
  • 769
Waheed
  • 10,086
  • 20
  • 53
  • 66

2 Answers2

2

No, this interface is not used by the XmlSerializer.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
1

Use IXmlSerializable instead.

Pent Ploompuu
  • 5,364
  • 1
  • 27
  • 47