Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serializable objects vs. non-serializable objects

What is the difference between serializable objects and non-serializable objects in C#, and what makes an object serializable?

What do serializable objects have to do with XML?

like image 266
devforall Avatar asked Sep 10 '10 17:09

devforall


1 Answers

what is the differnce Serializable objects vs non serialivable objects

A serializable object can be converted into some other representation such as text in order to be easily transmitted across process boundaries while a non-serializable object cannot.

And what makes an object serialiable

In .NET depending on the serializer you decide to use, the object needs to correspond to certain requirements. For example if you use the BinaryFormatter your object needs to be decorated with the [Serializable] attribute.

And What does serializable objects have to do with xml

An object could be serialized into XML. In .NET this could be achieved for example with the XmlSerializer class but also with the DataContractSerializer.

like image 68
Darin Dimitrov Avatar answered Oct 02 '22 01:10

Darin Dimitrov