I was going through WCF Fundamentals, Can anybody tells that under which scenarios should we use DataContractSerializer and XmlSerializer?
DataContractSerializer is better performance over Xmlserializer. This is because DataContratSerializer explicitly shows the which fields or properties are serialized into XML.
DataContractSerializer can able to serialize types that implements Idictionary whereas XML serializer not.
DataContractSerializer serializes all members which are marked with [DataMember] attribute even if member is marked private. XML serializer serialize only public members.
These are some important difference.
DataContractSerializer
XMLSerializer