Put attributes via XElement_Without duplicate XElement

  • Thread starter Thread starter Thabetidris
  • Start date Start date
T

Thabetidris

Guest
My objectif is to put attributes via XElement,

This is my code :

*** My Class

[DataContract]
public class Characeristic
{
[DataMember]
public XElement Definition = new XElement("Definition");
}

*** implementation

XAttribute attribute = new XAttribute("ID", Dimension.Id);
XAttribute attributeName = new XAttribute("Name", Dimension.Name);


I get this result:

<Definition>
<Definition ID="1" Name="COMPANY" xmlns=""/>
</Definition>


So the result has a duplicate name XElement "Definition",

I want the result like this :

<Definition id="1048591" Name="COMPANY"/>


How can I fix it ? Thanks,

Continue reading...
 
Back
Top