1

I have consumed a WSDL and one of the fields was from a enum type and in the generated reference.cs it created two fields for this:

The field was called 'IsPayment' and it generated one called IsPaymentField and IsPaymentFieldSpecified

I read from this answer: Why isn't my public property serialized by the XmlSerializer?

That items with public bool xxxSpecified with value of false are not serialized

So I manually in code set it to True and it worked.

But what has caused this field to generate this Specified field when every other field that uses the same struct does not?

the only difference I can see is in the WSDL this field has explicitly got: nillable=true minOccurs=0

all other fields have nothing, but the enum itself is defined as: nillable="true"

So the only difference is minOccurs on my value?

Thanks.

Community
  • 1
  • 1
Neil Walker
  • 6,400
  • 14
  • 57
  • 86
  • See here for an explanation of when the `xxxSpecified` field is auto-generated : [ShouldSerialize*() vs *Specified Conditional Serialization Pattern](https://stackoverflow.com/questions/37838640/shouldserialize-vs-specified-conditional-serialization-pattern). – dbc Jun 15 '16 at 18:33

0 Answers0