I am reading and building a new xml string in C# like this:
private string XmlString
{
get
{
if (my_xml.Nodes().Count() > 0)
{
var param = new XElement("param");
var ids = my_xml.Elements("ID").ToList();
foreach (var id in ids)
{
param.Add(new XElement("ids", new XElement("ID", id.Value)));
}
return param.ToString();
}
return null;
}
}
I get a xml string which is something like:
<param>
<ids>
<id>2</id>
</ids>
</param>
How should look like my method to get a xml string like this one with = :
<param>
<ids id="2"/>
</param>