In case of DataContractserialzier, during serialization and deserialization constructor won’t get invoked. However DataContractserializer supports callbacks which we can use for initialization.
These callbacks works with the help of some special attributes
- OnDeserializedAttribute– Marks method to be invoked immediately after the object is deserialized.
- OnDeserializingAttribute – Marks method to be invoked during deserialization of an object.
- OnSerializedAttribute– Marks method to be invoked immediately after the object is Serialized.
- OnSerializingAttribute – Marks method to be invoked during Serialization of an object.
public class MyData
For technical trainings on various topics like WCF, MVC, Business
Intelligence, Design Patterns, WPF, TFS and Basic fundamentals feel free to
SukeshMarla@Gmail.com or visit
For more stuff like this, click
here. Subscribe to
updates or follow at twitter
See following video on WCF(Windows Communication Foundation) One way contract: -
Click and see here for more
training on WCF(Windows