练手://------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:4.0.30319.269
//
//     对此文件的更改可能会导致不正确的行为,并且如果
//     重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------using System.Xml.Serialization;// 
// 此源代码由 xsd 自动生成, Version=4.0.30319.1。
// 
/// <res/>
[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 root {
    
    private string codeField;
    
    private rootMessage[] messageField;
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string code {
        get {
            return this.codeField;
        }
        set {
            this.codeField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute("message", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public rootMessage[] message {
        get {
            return this.messageField;
        }
        set {
            this.messageField = value;
        }
    }
}/// <res/>
[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 rootMessage {
    
    private string recordtotalcountField;
    
    private string recordlistcountField;
    
    private rootMessageRecordlistdetailItem[][] recordlistdetailField;
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string recordtotalcount {
        get {
            return this.recordtotalcountField;
        }
        set {
            this.recordtotalcountField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string recordlistcount {
        get {
            return this.recordlistcountField;
        }
        set {
            this.recordlistcountField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    [System.Xml.Serialization.XmlArrayItemAttribute("item", typeof(rootMessageRecordlistdetailItem), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
    public rootMessageRecordlistdetailItem[][] recordlistdetail {
        get {
            return this.recordlistdetailField;
        }
        set {
            this.recordlistdetailField = value;
        }
    }
}/// <res/>
[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 rootMessageRecordlistdetailItem {
    
    private string customernameField;
    
    private string customernoField;
    
    private string certificatenoField;
    
    private string sexField;
    
    private string birthdayField;
    
    private string telephoneField;
    
    private string addressField;
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string customername {
        get {
            return this.customernameField;
        }
        set {
            this.customernameField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string customerno {
        get {
            return this.customernoField;
        }
        set {
            this.customernoField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string certificateno {
        get {
            return this.certificatenoField;
        }
        set {
            this.certificatenoField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string sex {
        get {
            return this.sexField;
        }
        set {
            this.sexField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string birthday {
        get {
            return this.birthdayField;
        }
        set {
            this.birthdayField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string telephone {
        get {
            return this.telephoneField;
        }
        set {
            this.telephoneField = value;
        }
    }
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string address {
        get {
            return this.addressField;
        }
        set {
            this.addressField = value;
        }
    }
}/// <res/>
[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 NewDataSet {
    
    private root[] itemsField;
    
    /// <res/>
    [System.Xml.Serialization.XmlElementAttribute("root")]
    public root[] Items {
        get {
            return this.itemsField;
        }
        set {
            this.itemsField = value;
        }
    }
}

解决方案 »

  1.   

        class A
        {
            public int code;
            public M message;
        }
        class M
        {
            public int recordtotalcount;
            public int recordlistcount;
            public List<C> recordlistdetail;    }
        class C
        {
            public string customername;
            public string customerno;
            public int certificateno;
            public string sex;
            public string birthday;
            public string telephone;
            public string address;
        }A  就是了
      

  2.   

    借楼...
    大婶们!这段json该如何写实体类呢?{
      "status": 1,
      "rule": {
        "1": {
          "id": "1",
          "name": "方式1",
          "silver": 100
        },
        "2": {
          "id": "2",
          "name": "方式2",
          "gold": "2"
        }
      },
      "list": {
        "1": {
          "id": "343976",
          "name": "张三",
          "quality": "1",
          "level": "1",
          "image": "1",
          "type": "1",
          "wuli": "81",
          "zhili": "36",
          "tili": "71",
          "wuliup": "0",
          "zhiliup": "0",
          "tiliup": "0",
          "star": "1",
          "goout": "1",
          "cultivate": []
        }
      }
    }