Use an explicit cast:
from a in indexGenerale.Descendants("ITEM")
where (string)a.Element("IDITEM") == "2"
a.Element("IDITEM")
will return an XElement
and it will never be equal to "2"
.Maybe you meant a.Element("IDITEM").Value.Equals("2")
, that will also work but explicit cast is safer.It doesn't throw exception if the element wasn't found`,