What is .Net serialization
.Net Serialization (C#/VB.Net)
Serialization can be defined as the process of converting the state of an object instance to a stream of data, so that it can be transported across the network or can be persisted in the storage location. The advantage of serialization is the ability to transmit data across the network in a cross-platform-compatible format, as well as saving it in a persistent or non-persistent state of an object to a storage medium so an exact copy can be recreated at a later stage. Deserialization is its reverse process, that is unpacking stream of bytes to their original form.
Any attempt to pass the object as a parameter or return it as a result will fail unless the object derives from MarshalByRefObject. This process of serializing an object is also called deflating or marshalling an object. If the object is marshalling or it is marked as Serializable, the object will automatically be serialized.
The following program will show how to Serialize an Object and later De-serialize it
C# Source Code
VB.Net Source Code
There are three types of serialization in .Ne : Binary Serialization, SOAP Serialization and XML Serialization.
Binary serialization is the process where you convert your .NET objects into byte stream. In binary serialization all the public, private, even those which are read only, members are serialized and converted into bytes.
SOAP is a protocol based on XML, designed specifically to transport procedure calls using XML. Because a SOAP message is built using XML, the XmlSerializer can be used to serialize classes and generate encoded SOAP messages.
XML Serialization is the process of serializing a .Net Object to the form of XML or from an XML to .Net Object.
You can study a detailed lesson on XML Serialization from the following link :C# XML Serialization VB.Net XML Serialization