What is XML Serialization and Binary Serialization?XML Serialization - Makes it possible to convert any common language runtime objects into XML documents or streams and vise versa.
- The XML Serialization enables it to convert XML documents into such a meaningful format that the programming languages can process the converted documents with ease.
Binary serialization- Converts the files to a binay format. In this case all the data get converted into a binary format which is not a human readable format. In binary serialization entire object state is saved, instance identity is preserved and it graphs with multiple references can be handled in this.
- XML serialization does'nt allow these things.
What is XML Serialization and Binary Serialization?XML serialization - XML serialization is all about serializing an object into an XML file. Being an XML file is a flat text file, the file can be viewed, shared by another application. It is a stream of characters.
- XML serialization is called shallow serialization because it can serialize only public objects.
Binary serialization - Binary serialization is all about serializing an object into a Binary file. Being a binary file is a compact file and cannot be seen like a text file. In binary serialization, image objects can also be serialized. It is a stream of bytes.
- Binary serialization is called Deep serialization because it can serialize the object containing references to the other objects.
- In Binary serialization the entire object state is saved where as in XML serialization only some of the object data is saved.