I have a C# Application that communicates with the server using Json.
The server team has given me an xsd which I have used to generate C# classes with xsd2code.
While doing this, for each field in the xsd, xsd2code creates 2 fields in the generated C# classes. One with the same name as it is in xsd and another with the name suffixed with "Specified".
For example: Here's an xml from my xsd
<xsd:element name="depth" type="xsd:int" minOccurs="0"/>
Here's the corresponding fields that it generates.
private int depthField;
private bool depthFieldSpecified;
public int depth {
get {
return this.depthField;
}
set {
this.depthField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool depthSpecified {
get {
return this.depthFieldSpecified;
}
set {
this.depthFieldSpecified = value;
}
}
Is there a way to avoid getting the field suffixed with "Specified"? I need this to be removed because it is causing a problem when I try to serialize the object back to a json string. Even though I have populated the property depthField it doesn't serialize it by looking at depthFieldSpecified boolean which will be false by default.
I would be glad if someone can point me in the right direction. Thanks in Advance.