So I have this code:
List prices =
(from item in xmlDoc.Descendants(shop.DescendantXName)
select new PriceDet
XElement and XAttribute are both forms of XObject, so if a generic instance of type XObject will suffice for your needs, change your Cast to Cast.
If that won't work for your specific situation, you make use of OfType or OfType to filter for one or the other, but that would require two passes over the input, one to filter for XElement and a second pass to filter for XAttribute.