T
Thabetidris
Guest
I have a class "WsReferenceValue" that contains a list of other class "Characteristic" ,and the class Characteristic has a property another class "Definition",this is my code:
public class WsReferenceValue
{
[DataContract]
public class WsReferenceValue : WsEntitiesDimension
{
public List<Characteristic> listCharacteristic { get; set; }
}
[DataContract]
public class Characteristic
{
[DataMember]
public Definition definition { get; set; }
}
[Serializable]
public class Definition
{
[XmlAttribute]
public int id;
[XmlAttribute]
public string name;
}
*** My code :
WsReferenceValue referenceV = new WsReferenceValue();
List<Characteristic> ListFinalDynamic = new List<Characteristic>();
foreach (var finalCharac in listeCharactresticFinal)
{
var lstChars = new Characteristic()
{
Definition = new Definition()
{
id = Dimension.ID,
name = Dimension.Name
}
};
ListFinalDynamic.Add(lstChars);
referenceV.listCharacteristic = ListFinalDynamic;
}
And I get this result:
<WsReferenceValue>
<listCharacteristic>
<Characteristic>
<Definition>
<id>1</id>
<name>COMPANY</name>
</Definition>
</Characteristic>
<Characteristic>
<Definition>
<id>71</id>
<name>COUNTRY</name>
</Definition>
</Characteristic>
<Characteristic>
<Definition>
<id>45</id>
<name>CURRENCY</name>
</Definition>
</Characteristic>
</listCharacteristic>
And my goal is to get all list of Characterstics for one Reference with this format : (every Characterstic with attributes)
<WsReferenceValue>
<listCharacteristic>
<Characteristic>
<Definition id=1 name="COMPANY" />
</Characteristic>
<Characteristic>
<Definition id=71 name="COUNTRY" />
</Characteristic>
<Characteristic>
<Definition id=45 name="CURRENCY" />
</Characteristic>
</listCharacteristic>
How can I fix it ? Thanks
Continue reading...
public class WsReferenceValue
{
[DataContract]
public class WsReferenceValue : WsEntitiesDimension
{
public List<Characteristic> listCharacteristic { get; set; }
}
[DataContract]
public class Characteristic
{
[DataMember]
public Definition definition { get; set; }
}
[Serializable]
public class Definition
{
[XmlAttribute]
public int id;
[XmlAttribute]
public string name;
}
*** My code :
WsReferenceValue referenceV = new WsReferenceValue();
List<Characteristic> ListFinalDynamic = new List<Characteristic>();
foreach (var finalCharac in listeCharactresticFinal)
{
var lstChars = new Characteristic()
{
Definition = new Definition()
{
id = Dimension.ID,
name = Dimension.Name
}
};
ListFinalDynamic.Add(lstChars);
referenceV.listCharacteristic = ListFinalDynamic;
}
And I get this result:
<WsReferenceValue>
<listCharacteristic>
<Characteristic>
<Definition>
<id>1</id>
<name>COMPANY</name>
</Definition>
</Characteristic>
<Characteristic>
<Definition>
<id>71</id>
<name>COUNTRY</name>
</Definition>
</Characteristic>
<Characteristic>
<Definition>
<id>45</id>
<name>CURRENCY</name>
</Definition>
</Characteristic>
</listCharacteristic>
And my goal is to get all list of Characterstics for one Reference with this format : (every Characterstic with attributes)
<WsReferenceValue>
<listCharacteristic>
<Characteristic>
<Definition id=1 name="COMPANY" />
</Characteristic>
<Characteristic>
<Definition id=71 name="COUNTRY" />
</Characteristic>
<Characteristic>
<Definition id=45 name="CURRENCY" />
</Characteristic>
</listCharacteristic>
How can I fix it ? Thanks
Continue reading...