public static IEnumerable<XElement> EnumModbusSlaveNodes(IObjectStore store) { var cfg = default(XDocument); try { cfg = XDocument.Load(new StringReader(store.ReadObject("", CodesysConst.CFG))); } catch (XmlException xe) { TRACE.TraceEvent(TraceEventType.Error, 0, "XML exception at PLC config loading: “{0}”. Returning empty node collection.", xe.Message); return Enumerable.Empty<XElement>(); } return cfg.Root .Elements("module") .Elements("module-list") .Elements("module") .Where(x => (string)x.Attribute("type-name") == "MODBUS_ID400"); }