Add an XAttribute to the XElement constructor, e.g.
new XElement("Conn", new XAttribute("Server", comboBox1.Text));
You can also add multiple attributes or elements through the constructor.
new XElement("Conn", new XAttribute("Server", comboBox1.Text), new XAttribute("Database", combobox2.Text));
or you can use Add-Method for XElement to add attributes
XElement element = new XElement("Conn"); XAttribute attribute = new XAttribute("Server", comboBox1.Text); element.Add(attribute);
Jehof Feb 21 2018-11-11T00: 00Z
source share