Reputation: 6530
Is it true that every object that use .ToString() in asp.net can be called as serialization ? If yes then why and if no then why not..
Thanks
Upvotes: 0
Views: 115
Reputation: 465
All objects inherit tostring() from Object, but not all objects are serializable. Serialization does not involve the tostring method.
Upvotes: 0
Reputation: 1038720
No, this is not true. If an object overrides ToString
it means that you can print its values but the process is not necessary reversible. Serialization is a reversible process when an object instance is converted to some format. Deserialization is the inverse process when an object instance is created from some format. In .NET common formats for serializing objects are XML and binary. For binary serialization types need to be decorated with the [Serializable]
attribute.
Upvotes: 2