I cannot understand this code.
XDocument loaded = XDocument.Load(PATH);
var devices = new List<Device>(loaded.Descendants("Device").Select(e => new Device
{
UserName = "xxx",
Domain = e.Element("domain").Value,
FQDN = e.Element("fqdn").Value,
Password = e.Element("password").Value,
}));
How does it add these elements, and get the list of devices?
This code use LINQ to read the XML and create a list of Device objects with the info of the XML.
Filling the field like this:
your XML is like this: