I have a generated c# class from xsd. when I want to give value to the elements
result res = new result();
res.feed = "123132";
// This works
res.data here I can not find id and value, how can I do for instance res.data.id="something"
I have an xml :
<result>
<feed></feed>
<status></status>
<data>
<id></id>
<value></value>
<id></id>
<value></value>
</data>
</result>
that generates this xsd :
<xs:element name="result">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="feed"/>
<xs:element type="xs:string" name="status"/>
<xs:element name="data">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="value"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
and with xsd.exe I have generated the class for it
public partial class result {
private string feedField;
private string statusField;
private resultData dataField;
/// <remarks/>
public string feed {
get {
return this.feedField;
}
set {
this.feedField = value;
}
}
/// <remarks/>
public string status {
get {
return this.statusField;
}
set {
this.statusField = value;
}
}
/// <remarks/>
public resultData data {
get {
return this.dataField;
}
set {
this.dataField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
public partial class resultData {
private string[] itemsField;
private ItemsChoiceType[] itemsElementNameField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("id", typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("value", typeof(string))]
[System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")]
public string[] Items {
get {
return this.itemsField;
}
set {
this.itemsField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("ItemsElementName")]
[System.Xml.Serialization.XmlIgnoreAttribute()]
public ItemsChoiceType[] ItemsElementName {
get {
return this.itemsElementNameField;
}
set {
this.itemsElementNameField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.17929")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)]
public enum ItemsChoiceType {
/// <remarks/>
id,
/// <remarks/>
value,
}