I am trying to serialize an object using XmlSerializer. The input class that has a property with [XmlAttribute] is not showing up in output xml. Anyway to fix this?
1 Answer
For it not to appear at all, one of these things is usually true:
- the type is not appropriately accessible; for typical values, this means that it needs a
publicgetter and setter; if it lacks both: it will not be serialized (note that for collections, only a getter is required) - conditional serialization of some form is enabled (either via
[DefaultValue], or aShouldSerialize*()method), and is indicating to omit it - it is being fully ignored (
[XmlIgnore], for example)