Serialization and Deserialization in C#.NET(With Practical Examples)



Serialization and Deserialization in C#.NET
What is Serialization in C#?
Serialization in C# is the process of bringing an object into a form that it can be written on stream.
(Stream is used to ensure smooth read and write operations to the file)

Serialization the process of converting the object into a form so that it can be stored on a file, database, or memory.

Serialization main purpose is to save the state of the object so that it can be recreated when needed.
Uses for serialization
Serialization allows the us to save the state of an object and re-create object as needed.
Using Webservices we can pass object to remote application.
Sending an object from one domain to another.
Passing an object through a firewall as a JSON or XML string
We can maintain security or user-specific information across applications.
What is Deserialization in C#?

Deserialization in C# is the reverse process of serialization.
It restores the state of the object by setting properties, fields etc.
It is the process of getting back the serialized object. It can be loaded into memory.

Types of Serialization

1) Binary Serialization
2) XML Serialization
3) JSON Serialization

Comments are closed.