what is Serialization?
Ans:
Serialization is a process to convert a complex objects into stream of bytes for storage (database, file, cache, etc) or transfer. Its main purpose is to save the state of an object.
Deseailization: Vice-versa
What Are The Types Of Serialization?
Answer :
The types of Serializations are given bellow:
1 Binary Serialization
In this process all the public, private, read only members are serialized and convert into stream of bytes. This is used when we want a complete conversion of our objects.
2 SOAP Serialization
In this process only public members are converted into SOAP format. This is used in web services.
3 XML Serialization
In this process only public members are converted into XML. This is a custom serialization. Required namespaces: System.Xml, System.Xml.Serialization.
Ans:
Serialization is a process to convert a complex objects into stream of bytes for storage (database, file, cache, etc) or transfer. Its main purpose is to save the state of an object.
Deseailization: Vice-versa
What Are The Types Of Serialization?
Answer :
The types of Serializations are given bellow:
1 Binary Serialization
In this process all the public, private, read only members are serialized and convert into stream of bytes. This is used when we want a complete conversion of our objects.
2 SOAP Serialization
In this process only public members are converted into SOAP format. This is used in web services.
3 XML Serialization
In this process only public members are converted into XML. This is a custom serialization. Required namespaces: System.Xml, System.Xml.Serialization.
Answer :
For example consider, we have a very complex object and we need XML format to show it on HTML page. Then we can create a XML file in the disk, writes all the necessary data on the XML file, and use it for the HTML page. But this is not good approach for large number of users. Extra space is required; anyone can see the XML file which creates security issue. We can overcome it by using XML serialization.
Uses of Serialization
- To save the state of an object into a file, database etc. and use it latter.
- To send an object from one process to another (App Domain) on the same machine and also send it over wire to a process running on another machine.
- To create a clone of the original object as a backup while working on the main object.
- A set of objects can easily be copied to the system’s clipboard and then pasted into the same or another application
No comments:
Post a Comment