I am using XmlSerializer against an XSD.EXE generated class.
XmlSerializer serializer = new XmlSerializer(obj.GetType());
Throws up
InvalidOperationException Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'itemOrderItemsItem[]' to 'itemOrderItemsItem' error CS0029: Cannot implicitly convert type 'itemOrderItemsItem' to 'itemOrderItemsItem[]'
The fix (labeled <!--fix...-->
below) says to add some silly element to my schema, but this isn't working. This fix is five years old. Is there a solution yet?
<xs:sequence>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="model" type="xs:string" minOccurs="0" />
<xs:element name="description" type="xs:string" minOccurs="0" />
<xs:element name="material" type="xs:string" minOccurs="0" />
<xs:element name="lot" type="xs:string" minOccurs="0" />
<xs:element name="serial" type="xs:string" minOccurs="0" />
<xs:element name="transferQty" type="xs:string" minOccurs="0" />
<xs:element name="shipQty" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="tmp" type="xs:string" /><!--fix...-->