Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Which is better, custom serialization or basic serialization?


Asked by Dennis Matthews on Dec 11, 2021 FAQ



When you use basic serialization, the versioning of objects may create problems, in which case custom serialization may be preferable. Basic serialization is the easiest way to perform serialization, but it does not provide much control over the process.
Likewise,
Basic serialization is the easiest way to perform serialization, but it does not provide much control over the process. In custom serialization, you can specify exactly which objects will be serialized and how it will be done. The class must be marked SerializableAttribute and implement the ISerializable interface.
And, The basic advantage of serialization is the ability of an object to be serialized into a persistent or a non-persistent storage media and then reconstructing the same object if required at a later point of time by de-serializing the object.
Furthermore,
In simple words, object serialization is the process of saving an object's state to a sequence of bytes and deserialization is the process of reconstructing an object from those bytes. Generally, the complete process is called serialization but I think it is better to classify both as separate for more clarity.
Accordingly,
Basic serialization uses the .NET Framework to automatically serialize the object. The only requirement in basic serialization is that the object has the SerializableAttribute attribute applied. The NonSerializedAttribute can be used to keep specific fields from being serialized.