Has "minOccurs = 0" sufficient to force .NET to create the xxxSpecified field

I used WSDL, and one of the fields was of type enum, and in the generated reference.cs two fields were created for this:

The field was named "IsPayment" and it generated one of them: IsPaymentField and IsPaymentFieldSpecified

I read from this answer: Why is my public property not serialized by XmlSerializer?

That elements with public bool xxxSpecified with false are not serialized

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

But what caused this field to create this specified field when not all other fields that use the same structure?

The only difference I see in WSDL is this field explicitly: nillable = true minOccurs = 0

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

So the only difference is: minOccurs in my opinion?

Thank.

+1
serialization web-services
Apr 27 '16 at 20:20
source share

No one has answered this question yet.

See similar questions:

43
Why is my public property not serialized by XmlSerializer?
12
ShouldSerialize * () vs * Conditional conditional serialization pattern

or similar:

57
Deserialize an empty xml attribute value into a nullable int property using XmlSerializer
6
svcutil.exe - created proxy that does not allow fields with zero value
four
Optional enumeration with WCF client
four
C # from .NET 3.5 does not serialize ENUM provided by Java Web Service
2
Conditionally serialization / deserialization attribute
2
Setting minOccurs = 0 to WSDL using the Specified pattern does not work
0
XML serialization causes missing fields
0
Deserializing wsdl object does not include all C # objects
0
How to create a .NET Web service based on a fixed WSDL that supports multi-level deserialization
0
Serializing Silverlight .NET Web Service Causes XML Error



All Articles