The first thing I see is that your
new
statement is junk. It should be something like this:
var result = from ele in doc.Descendants()
where ele.HasElements == false
select new SomeObject(){ ParentName=ele.Parent.Name, Name=ele.Name , Value=ele.Value };
The second thing I see is the use of var in your
foreach
statement. Just use the correct type. It's much more efficient.
Finally, I recommend that you use complete words for variable names. It makes your code a LOT easier to read.