That Linq
select
doesn't return an
XmlNode
, it returns a
IEnumerable<XmlNode>
- so you can't just store it a in
node
variable.
Try adding .FirstOrDefault:
XmlNode node = (from XmlNode x in ThisAddIn.XmlNodesModelStyles where styleName == x.Attributes["name"].Value select x).FirstOrDefault();