I want to know about the term "Serialization". Although, I have read many books, but the concept is not clear yet.
Please reply with an easy and live example, if possible.
Thanks a ton in advance......
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 attend5days leftRegister
Zoran HorvatRank #792 · 2.9K reputationPosted Jul 18, 2011, 4:05 AM EDT
Term "serialization" is derived from the fact that object which might be scattered in memory is now put into series of successive memory locations. As such, it can be written into file, sent over network, etc.
Main point about serialization is that resulting series can be de-serialized into another instance which is identical to the instance which was originally serialized. This implies that serialization is a lossless process. On the contrary, if object is serialized into, say string, with loss of data, then it could rather be called formatting - string is formatted to depict content of the object, but no opposite process is possible, i.e. object cannot be reconstructed from the formatted string.
.NET uses reflection to investigate serializable types and to create wrapper classes which are capable to create XML elements for public properties quickly. Whenever you use new Serializer(typeof(MyClass)), .NET will effectively instantiate object of generated wrapper class which has all properties equal as MyClass, but some additional methods that allow quick formatting back and forth between MyClass objects and XML elements.
You can also refer to my article Best Practices in .NET XML Serialization of Complex Classes for some techniques applied to XML serialization of complex classes.
Hope this helped.
Zoran