I have an xsd file that has the following definition below. When using xsd.exe
to generate classes from the xsd file, the enum attrs get an additional FieldSpecified
property as visible below. Unless the FieldSpecified
property is set, the value will not serialize with the value of the attribute. Is there an additional property I can add to the xsd or a flag I can use with xsd.exe
to always cause the value to be serialized?
Example from xsd
:
<xs:simpleType name="adrLn">
<xs:restriction base="xs:string">
<xs:enumeration value="ST" />
<xs:enumeration value="APTN" />
</xs:restriction>
</xs:simpleType>
...
<xs:element name="AddressLine" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="AddrLineTypCd" type="adrLn" />
</xs:complexType>
</xs:element>
Example from generated code:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class RequestCheckIssueAddressAddressLine {
private adrLn addrLineTypCdField;
private bool addrLineTypCdFieldSpecified;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public adrLn AddrLineTypCd {
get {
return this.addrLineTypCdField;
}
set {
this.addrLineTypCdField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool AddrLineTypCdSpecified {
get {
return this.addrLineTypCdFieldSpecified;
}
set {
this.addrLineTypCdFieldSpecified = value;
}
}
}