Look at your code just changed to show the level of nesting:
service.Add(new XElement("ID",
idulong.ToString(),
new XElement("Succesfull",
1)));
In other words, the Succesfull
element is within the ID
element constructor call.
You just want to add two separate elements, either with two separate calls to service.Add
:
service.Add(new XElement("ID", idulong.ToString());
service.Add(new XElement("Succesfull", 1));
or in one call to Add
, taking multiple elements:
service.Add(new XElement("ID", idulong.ToString()),
new XElement("Succesfull", 1));
You don't need to call ToString
, by the way - it's fine to write:
service.Add(new XElement("ID", idulong),
new XElement("Succesfull", 1));
(You might want to use Successful
or just Success
instead of Succesfull
though...)