views:

28

answers:

0

I am trying to ignore a property value (XML Attribute for serialization) if the value is not set. This is easy with most classes using the special PropertyNameSpecified boolean but it doesn't work with some base types that always have a value such as integer and boolean. An integer that has never been set explicitly will still have a value of 0, for instance. Is there a way to ignore, for serialization, properties whose values are say -1 or false or something to that effect?