My desktop application serializes objects using XmlSerializer. I was suggested to leverage DataContractSerializer instead.
Under which scenarios should I use DataContractSerializer?
Many thanks
Comments.
1. The output XML file is stored locally. No other applications deserialize objects from that XML file.
2. My application runs with .NET Framework 3.5 SP1.
Dan Rigsby has the ultimate post on this – go read it!
XmlSerializer vs. DataContractSerializer (web archive)
He says all there is to say, and in a very convincing way.
In short:
XmlSerializer:
DataContractSerializer is:
[DataMember]will be serialized[DataMember]will be serialized – whether it’spublicorprivate