views:

20

answers:

2

Hi,

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

+2  A: 

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.

Darin Dimitrov
A: 

All objects inherit tostring() from Object, but not all objects are serializable. Serialization does not involve the tostring method.

MCain