XSD tool appends “Specified” to certain properties/fields when generating C# code

后端 未结 2 970
猫巷女王i
猫巷女王i 2020-12-18 22:40

I got a strange behaviour with the XSD generator I can\'t really explain. I got an XSD like this:



        
相关标签:
2条回答
  • 2020-12-18 23:15

    Set minOccurs="1" where element is nillable. For example:

    <xs:element name="StageOnDemand" type="xs:boolean" nillable="true" minOccurs="1" />
    
    0 讨论(0)
  • the bool attribute means the related attribute should be serialized.

    e.g.

    If the bool MinDuration_100msSpecified is set to false, and you set the MinDuration_100ms to be 300, when you use XmlSerializer to serialize the object, the MinDuration_100ms attribute won't be serialized.

    This feature can save the serialized xml file to be minimal.

    0 讨论(0)
提交回复
热议问题