XML to C# Class Question

前端 未结 7 1284
走了就别回头了
走了就别回头了 2020-12-17 01:07

Can someone please help me, I have this xml snippet



  123         


        
7条回答
  •  -上瘾入骨i
    2020-12-17 01:39

    Did you use VS2008's XSD?

    Here's the output I got:

    c:>xsd email.xml
    Writing file 'c:\email.xsd'
    
    c:>xsd email.xsd /c /edb
    Writing file 'c:\email.cs'
    

    Generates serializable output:

    [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
    [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 EmailConfiguration : object,  System.ComponentModel.INotifyPropertyChanged {
    
    private string dataBoxIDField;
    
    private EmailConfigurationDefaultSendToAddressCollection[] defaultSendToAddressCollectionField;
    
    /// 
    [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public string DataBoxID {
        get {
            return this.dataBoxIDField;
        }
        set {
            this.dataBoxIDField = value;
            this.RaisePropertyChanged("DataBoxID");
        }
    }
    

提交回复
热议问题