I have on object which a client wishes to serialize and deserialize - specifically via XML.
The problem is this means I have to ensure that the properties are read write. But I don't really want to do this since the data is "set once". So, how can I detect that an object is currently being deserialized by the XML deserializer.
Basically what I need to do isonly allow the property to be set during deserialization, IDeserializationCallback doesn't help since that only has OnDeserialization called after completion of deserialization.
I think OnDeserializingAttribute/OnDerserializedAttribute might to appropriate so that I can detect deserialization is in progress. Anybody tried this ??
The problem is this means I have to ensure that the properties are read write. But I don't really want to do this since the data is "set once". So, how can I detect that an object is currently being deserialized by the XML deserializer.
Basically what I need to do isonly allow the property to be set during deserialization, IDeserializationCallback doesn't help since that only has OnDeserialization called after completion of deserialization.
I think OnDeserializingAttribute/OnDerserializedAttribute might to appropriate so that I can detect deserialization is in progress. Anybody tried this ??
Comment