In serialization (Binary Serialization) what data is being transferred? An instance of a class (object) or values assigned to that object's properties.
I want to know what happens in the serialization process basically? I mean an object is converted to it's target file or whatever in serialization. But how? What steps are followed in this process?
Can someone help?
Jay...
The following types built into the . NET Framework can all be serialized and are considered to be primitive types: Byte, SByte, Int16, Int32, Int64, UInt16, UInt32, UInt64, Single, Double, Boolean, Char, Decimal, Object, and String.
Serialization is the process of storing the state of an object to a storage medium. In binary serialization, the public and private fields of the object and the name of the class, including the assembly containing the class, are converted to a stream of bytes, which is then written to a data stream.
Data serialization is the process of converting an object into a stream of bytes to more easily save or transmit it. The reverse process—constructing a data structure or object from a series of bytes—is deserialization.
Serialization is the process of translating data structures or object state into a format that can be stored and resurrected later in the same or another computer environment.
Binary Serialization is taking snap shoot of object and serializes it. Meaning all private fields, that are not marked as NonSerializable, will be serialized with their values. All objects used in object hierarchy must be maked as Serializable. You should put [field:NonSerializable] attribute on events, so event handlers don't get serialized too: http://bytes.com/groups/net-c/250944-nonserialized-attribute-events#post1013968
Keep in mind that when deserializing object, you have to have exactly the same object in same assembly as when you serialized it (same meaning same assembly info). If not, you can use SerializationBinder class so you can reset type in which stream will be sterilized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With