xml to xsd to c# class - C# 3.0, .net 3.5
Posted
by uno
on Stack Overflow
See other posts from Stack Overflow
or by uno
Published on 2010-04-05T13:23:25Z
Indexed on
2010/04/05
13:33 UTC
Read the original article
Hit count: 253
Following this articlelink text
one of the comments from 'zanoni' said he did it this way
Using .NET 3.5:
[XmlRoot]
public class EmailConfiguration
{
[XmlElement]
public string DataBoxID { get; set; }
[XmlElement]
public DefaultSendToAddressCollectionClass DefaultSendToAddressCollection { get; set; }
}
public class DefaultSendToAddressCollectionClass
{
[XmlElement]
public string[] EmailAddress { get; set; }
}
How would I get my class to be as what he described? I ran the xsd tool and it is in the fashion as what shane posted in the above link
[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;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string DataBoxID {
get {
return this.dataBoxIDField;
}
set {
this.dataBoxIDField = value;
this.RaisePropertyChanged("DataBoxID");
}
}
© Stack Overflow or respective owner