First of all Serialization is a process of translating Object state into a format that can be stored and if want transmitted.
In this article I would like to talk about difference between XmlSerializer and DataContractSerialzier.
DataContractSerializer
Best when we want to serialize some of the properties in object.
It uses Opt-In approach. It means we have to explicitly specify which properties need to be serialized
It can serialize not only properties but also fields.
It can serialize properties with only Get Accessor
Faster
It can only work in WCF
XmlSerializer
Best when we want to serialize most of the properties in object.
It used Opt-out approach. It means we have to explicitly specify which properties you don't want to serialize
It can also serialize nonpublic members
It can only serialize public properties which must have both Get and Set Accessor.
Slower compare to DataContractSerializer
It can work for WCF and Webservices (asmx)