Setting empty values using IsValid and Null

Simple Types

Simple Types declared within your schema will generate a property in the code with a simple type (e.g. int). If the item is declared as optional (i.e. minOccurs=0), then an additional property named IsValid... will be generated within the code. Setting the associated IsValid... = false, will omit the property from the output XML document on serialization.

Mandatory items do not require an IsValid as they must always contain a valid values, e.g. for a property of type int this may be = 0.

Complex Types

Complex Types declared within your schema will generate a property in the code with a complex type (i.e an object reference). If the item is decared as optional (i.e. minOccurs=0), then setting the property = null will omit the property from the output XML document on serialization.

Add Feedback