What Does Serialization Mean?

Serialization is the process of converting the state information of an object instance into a binary or textual form to persist into storage medium or transported over a network.


Serialization is executed by Common Language Runtime (CLR) to save an object‘s current state information to a temporary (like ASP.NET cache) or permanent storage (file, database, etc.) so as to be used later to update an object with this same information. It involves the conversion of public and private members of an object including the name of class and assembly into a stream of bytes, which is then written to data stream. The reverse process of converting stream of bits into an object is called deserialization.

The .NET framework offers two methods of serialization, namely, binary serialization and XML serialization. Binary serialization preserves the state of the object between different invocations of an application by preserving type fidelity. XML serialization uses XML as an open standard to serialize only the public properties and fields. It does not preserve type fidelity but provides support for serialization in human-readable, cross-platform XML. The framework provides many options to customize the serialization process to meet application requirements.

Techopedia Explains Serialization

Serialization is used when large amounts of data have to be stored in flat files and retrieved at a later stage. To achieve this without serialization, it becomes too tedious, error-prone and complicated as the data structure is complex. Reflection is a technique the .NET framework provides to automatically serialize all the members of an assembly into storage. Remoting is a concept using binary serialization to send arguments in methods from one computer to another. Examples of its usage include saving session state in ASP.NET, copying objects in clipboard in Windows Forms, etc. Serialization (XML) is also used mostly on sharing data across the network without restricting the application on usage of data.

Serialization can be implemented in any .NET objects by including the attribute Serializable to the class. By tagging the OptionalField attribute to the newly added members of the class, the earlier versions of the object can be deserialized without any error. The serialization engine used in .NET framework ensures that serialization occurs only once per object and handles object graphs and circular references automatically.


Related Terms

Latest Database Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…