Please consider this example class:
[Serializable] public class SomeClass { private DateTime _SomeDateTime; public DateTime SomeDateTime { get { return _SomeDateTime; } set { _SomeDateTime = value; } } }
I would like to alter the serialization of any DateTime declared in the class according to my own rules. The members of this class will change frequently and I don’t want to maintain a custom serializer for every change. Also I would like this behaviour to be inherited by subclasses and not code a custom serializer for every one. The serialization is being output by a web service. Thanks for any help!
look at the OnSerializing and OnDeserializing attributes to call custom methods when your objects are serialized. you can impelment some custom logic in there and decouple the serializing process from the actual datatypes.