I am using XmlSerializer to write and read an object to xml in C#. I currently use the attributes XmlElement and XmlIgnore to manipulate the seria
For extensibility reasons, XmlSerializer is very forgiving when it comes to deserialization; things like [DefaultValue], ShouldSerialize{Foo} and {Foo}Specified are mainly used during serialization (the exception being {Foo}Specified, which is set during deserialization as well as queried during serialization).
As such; there isn't an easy way to do this, unless you implement IXmlSerializable and do it yourself. damagednoob shows an xsd option, which is also an option.