C# xml反序列化的类咋写 (穷,只有5个财富值,要钱的路过就行)

2025-02-27 11:30:27
推荐回答(3个)
回答1:

//------------------------------------------------------------------------------
// 
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18063
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// 

//------------------------------------------------------------------------------

using System.Xml.Serialization;

// 
// This source code was auto-generated by xsd, Version=4.0.30319.1.
// 


/// 
[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 Items {
    
    private ItemsItem[] items1Field;
    
    /// 
    [System.Xml.Serialization.XmlElementAttribute("Item", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public ItemsItem[] Items1 {
        get {
            return this.items1Field;
        }
        set {
            this.items1Field = value;
        }
    }
}

/// 
[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 ItemsItem {
    
    private ItemsItemItemData[] itemDataField;
    
    /// 
    [System.Xml.Serialization.XmlElementAttribute("ItemData", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
    public ItemsItemItemData[] ItemData {
        get {
            return this.itemDataField;
        }
        set {
            this.itemDataField = value;
        }
    }
}

/// 
[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 ItemsItemItemData {
    
    private string nameField;
    
    private string valueField;
    
    /// 
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public string name {
        get {
            return this.nameField;
        }
        set {
            this.nameField = value;
        }
    }
    
    /// 
    [System.Xml.Serialization.XmlTextAttribute()]
    public string Value {
        get {
            return this.valueField;
        }
        set {
            this.valueField = value;
        }
    }
}

回答2:

    [XmlElement(ElementName = "Items")]
    public class Items
    {
        public Items()
        {
            this._itemlist = new List();
        }

        private List _itemlist;

        [XmlElement(ElementName = "Item")]
        public List itemlist
        {
            get { return _itemlist; }
            set { _itemlist = value; }
        }
    }
    public class Item
    {
        public Item()
        {
            this._itemdatalist = new List();
        }
        private List _itemdatalist;
        [XmlElement(ElementName = "ItemData")]
        public List itemdatalist
        {
            get { return _itemdatalist; }
            set { _itemdatalist = value; }
        }
    }
    class ItemData
    {
        [XmlAttribute(AttributeName = "name")]
        public string name { get; set; }

        [XmlText]
        public string text { get; set; }
    }

回答3:

先采、、、、、?、、、纳 谢谢