How can I modify a value just before the serialization or just after the deserialization?
You can add custom attribute to some method. Your marked method will get called a the right time. This is usefull to initialize a property after the deserialization or to clean up your instance before the serialization. • OnDeserializingAttribute :This event happens before deserialization • OnDeserializedAttribute :This event happens after deserialization • OnSerializingAttribute :This event happens before serialization • OnSerializedAttribute :This even happens after serialization [Serializable] public class SecurityToken { private string password; private string userName; private string Decrypt(string aPassword) { // Decrypt the password here !!! return password; } private string Encrypt(string aPassword) { // Encrypt the password here !!!