Does anybody know how I can control the deserialization process of a custom class when it has been serialized with the binary formatter?
I have my serializable class Dat which contains 2 fields:
class Dat
{
uint A;
[field: NonSerialized]
object Data;
string File;
}
What I want to do is when the class is deserialized I have no object data, and I just want to load it after its deserialized like this (in Dat class):
void AfterDeserialize()
{
Data = File.ReadAllBytes(File);
}
Sure I could just deserialize the class and the load it afterwards but that's almost not possible because it is in a complicated tree like structure. So does anybody know how to get a event or method with is called after deserialization?