Thursday 30 April 2015

Difference between Datacontractserialization and xmlserialization in WCF:-



 DataContractSerializer
XmlSerializer
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
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 serialize not only properties but also fields.
It can also serialize nonpublic members
It can serialize properties with only Get Accessor
It can only serialize public properties which must have both Get and Set Accessor.
Faster
Slower compare to DataContractSerializer
It can only work in WCF
It can work for WCF and Webservices (asmx)

No comments:

Post a Comment