There is such code:
XDocument doc = new XDocument( new XElement("Cards", new XElement("Card", new XAttribute("number", labelCard.Text), listarticle.Select(i => new XElement("product", new XAttribute("article", i))), listcount.Select(a => new XAttribute("counts", a)) ))); doc.Save(@"../data/report/" + labelCard.Text + ".xml"); The compiler swears at the second XElement. Writes a "duplicate attribute. What am I doing wrong?