When I generate a c# class from a xsd schema with xsd.exe I find this behaivor a bit wierd.
My element:
<xs:element name="InvoiceNo" type="xs:integer"/>
is generated to:
[System.Xml.Serialization.XmlElementAttribute(DataType="integer", Order=5)]
public string InvoiceNo
{
...
}
Why is that property not generated as an int instead of string?
This behavior is by design:
Use
xs:int, which is a signed 32-bit integer, to have Xsd.exe map it to a System.Int32:Here’s a detailed list of the data types defined in the XML Schema Definition standard.