I just learned about the XmlSerializer class in .Net. Before I had always parsed and written my XML using the standard classes. Before I dive into this, I am wondering if there are any cases where it is not the right option.
EDIT: By standard classes I mean XmlDocument, XmlElement, XmlAttribute…etc.
There are many constraints when you use the
XmlSerializer:publicparameterless constructor (as mentioned by idlewire in the comments, it doesn’t have to be public)These constraints often force you to make certain design decisions that are not the ones you would have made in other situations… and a tool that forces you to make bad design decisions is usually not a good thing 😉
That being said, it can be very handy when you need a quick way to store simple objects in XML format. I also like that fact that you have a pretty good control over the generated schema.