Hi all,
What is the practical use of serialization?How it is used in development?
Thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Zoran HorvatRank #792 · 2.9K reputationPosted Nov 16, 2010, 6:10 AM EST
For example, if two instances of application communicate over socket by sending messages, message can be an instance of some class. Then you just fill object's properties with values you want to send to the remote instance, then serialize the object into XML and write it to socket. Remote application reads XML from the socket and deserializes it into object of message class. In that way, one appication instance has effectively sent an object to another application instance.
Similarly, you can use binary serialization, but that is dangerous in sense that version of object must be exactly the same - any change in internal fields of the class will cause deserialization failure. Apart from that problem, binary serialization produces much smaller output.
Power of this way of working is that it's simple - serializing and deserializing one object takes only several lines of code, regardless of object complexity.
Drawback of this way of serialization is that you have to write class knowing in advance that it will be serialized. For example, all content must be gettable and settable via properties. Nothing that is set like using AddThis method will not be serialized. Also, circular references cannot be serialized (that would end up in infinitely large XML).
Sam HobbsRank #107 · 20.5K reputationPosted Nov 16, 2010, 9:15 AM EST
ali raza78 reputationPosted Nov 19, 2010, 10:53 PM EST
http://techgulf.blogspot.com/2010/11/viewstate-error-in-aspnet.html