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 wich 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 thats 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?