[英]XSD: Using Visual studio xsd.exe not generating Array[] instead of List<>
Im using the xsd.exe tool to generate classes from a xsd file. 我使用xsd.exe工具从xsd文件生成类。 The xsd file:
xsd文件:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="BAXML">
<xs:annotation>
<xs:documentation></xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Limit" minOccurs="1" maxOccurs="10">
<xs:complexType>
<xs:sequence>
<xs:element name="LimitType">
<xs:annotation>
<xs:documentation></xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="3"/>
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Amount">
<xs:annotation>
<xs:documentation></xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:int">
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
The output is: 输出是:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class BAXML {
private string counterpartyOrgNrField;
private BAXMLLimit[] limitField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Limit")]
public BAXMLLimit[] Limit {
get {
return this.limitField;
}
set {
this.limitField = value;
}
}}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class BAXMLLimit {
private string limitTypeField;
private int amountField;
/// <remarks/>
public string LimitType {
get {
return this.limitTypeField;
}
set {
this.limitTypeField = value;
}}
/// <remarks/>
public int Amount {
get {
return this.amountField;
}
set {
this.amountField = value;
}
}}
Instead of: 代替:
private BAXMLLimit[] limitField;
I would like it to be 我希望它是
List<BAXMLLimit> limitField
Is there a way in the xsd todo this? 这是xsd todo中的一种方法吗? Or some other way?
或者其他一些方式? Thx!
谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.