<bdo id='hKFcj'></bdo><ul id='hKFcj'></ul>

      <i id='hKFcj'><tr id='hKFcj'><dt id='hKFcj'><q id='hKFcj'><span id='hKFcj'><b id='hKFcj'><form id='hKFcj'><ins id='hKFcj'></ins><ul id='hKFcj'></ul><sub id='hKFcj'></sub></form><legend id='hKFcj'></legend><bdo id='hKFcj'><pre id='hKFcj'><center id='hKFcj'></center></pre></bdo></b><th id='hKFcj'></th></span></q></dt></tr></i><div id='hKFcj'><tfoot id='hKFcj'></tfoot><dl id='hKFcj'><fieldset id='hKFcj'></fieldset></dl></div>
    1. <tfoot id='hKFcj'></tfoot>

      <small id='hKFcj'></small><noframes id='hKFcj'>

    2. <legend id='hKFcj'><style id='hKFcj'><dir id='hKFcj'><q id='hKFcj'></q></dir></style></legend>
    3. XSD:使用 Visual Studio xsd.exe 不生成 Array[] 而不是

      时间:2023-06-04
        <bdo id='tH8P8'></bdo><ul id='tH8P8'></ul>
        <legend id='tH8P8'><style id='tH8P8'><dir id='tH8P8'><q id='tH8P8'></q></dir></style></legend>
      • <tfoot id='tH8P8'></tfoot>

            <small id='tH8P8'></small><noframes id='tH8P8'>

                <i id='tH8P8'><tr id='tH8P8'><dt id='tH8P8'><q id='tH8P8'><span id='tH8P8'><b id='tH8P8'><form id='tH8P8'><ins id='tH8P8'></ins><ul id='tH8P8'></ul><sub id='tH8P8'></sub></form><legend id='tH8P8'></legend><bdo id='tH8P8'><pre id='tH8P8'><center id='tH8P8'></center></pre></bdo></b><th id='tH8P8'></th></span></q></dt></tr></i><div id='tH8P8'><tfoot id='tH8P8'></tfoot><dl id='tH8P8'><fieldset id='tH8P8'></fieldset></dl></div>
                  <tbody id='tH8P8'></tbody>

                本文介绍了XSD:使用 Visual Studio xsd.exe 不生成 Array[] 而不是 List&lt;&gt;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我正在使用 xsd.exe 工具从 xsd 文件生成类.xsd 文件:

                Im using the xsd.exe tool to generate classes from a xsd file. The xsd file:

                <?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>
                

                输出是:

                /// <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;
                    }
                }}
                

                代替:

                private BAXMLLimit[] limitField;
                

                我希望它是

                List<BAXMLLimit> limitField
                

                xsd 中有没有办法做到这一点?还是其他方式?谢谢!

                Is there a way in the xsd todo this? Or some other way? Thx!

                推荐答案

                尝试使用 xsd2code.这比 xsd.exe 效果更好.您还可以通过设置 CollectionObjectType 属性来指定您希望您的集合如何成为一个选项.列表或数组.

                Try using xsd2code. This works better than xsd.exe. You can also specify as an option how you want your collections to be.. List or an Array by setting the CollectionObjectType property.

                这篇关于XSD:使用 Visual Studio xsd.exe 不生成 Array[] 而不是 List&lt;&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:无效的 URI:Uri 字符串太长 下一篇:在 Visual Studio IDE 中从 XSD 自动生成 C#

                相关文章

                最新文章

              1. <small id='FVm96'></small><noframes id='FVm96'>

                <legend id='FVm96'><style id='FVm96'><dir id='FVm96'><q id='FVm96'></q></dir></style></legend>
                    <bdo id='FVm96'></bdo><ul id='FVm96'></ul>

                    <tfoot id='FVm96'></tfoot>
                    <i id='FVm96'><tr id='FVm96'><dt id='FVm96'><q id='FVm96'><span id='FVm96'><b id='FVm96'><form id='FVm96'><ins id='FVm96'></ins><ul id='FVm96'></ul><sub id='FVm96'></sub></form><legend id='FVm96'></legend><bdo id='FVm96'><pre id='FVm96'><center id='FVm96'></center></pre></bdo></b><th id='FVm96'></th></span></q></dt></tr></i><div id='FVm96'><tfoot id='FVm96'></tfoot><dl id='FVm96'><fieldset id='FVm96'></fieldset></dl></div>