Store and Recover Information About Object Using Binary Serialization in C#

Only available on StudyMode
  • Topic: XML, Serialization, Component Object Model
  • Pages : 4 (649 words )
  • Download(s) : 123
  • Published : April 22, 2013
Open Document
Text Preview
Report

Store and Recover Information about Object Using Binary Serialization in C#

What is Binary Serialization:
Serialization is the process taking an object and converting it to a format which can be transported through net work or store into a storage medium, the storage medium could be file, database, or memory.

The .NET Framework provides two types of serialization, XML serialization and Binary serialization.

There are also three formats provided by the Microsoft .NET framework to which objects can be serialized. The formats are binary, SOAP, and XML.

Binary serialization can either the binary or the SOAP formatter, are suitable for storing object Information in .NET applications, and you don’t need share the information with non-.NET programs. When I mention Binary serialization below I mean “Binary serialization” using binary formatter, as short expression.

Why use Binary Serialization:
The binary serialization working chart is:
[pic]
The chart also can present the other two format of serialization. so why we use Binary serialization instead of use the other two? What the advantage and disadvantage of binary serialization?

The binary serialization is the most compact and light of the three formats and it is the fastest one of the three formats. Also the binary serialization can serialize all the state of the object, including type information. Therefore when the object is deserialized, you get an accurate and fully functional copy of the original, which xml will not It ignores private member fields and properties.

The main limitation of using binary serialization is that binary serialization depends on platform, while XML and SOAP do not adhere to that limitation.Therefore only when all your applications which use serialization are .net framework applications, you can use binary serialization, otherwise uses other two formats instead.

Using Binary Serialization in C#:
The code to using Binary serialize is very simple. The...
tracking img