Re: LINQ and XML for compact framework



On May 1, 2:54 pm, Wan <luo...@xxxxxxxxx> wrote:

<snip>

'msgs' is empty. There is two possiblities here.
1) from el in root.Descendants("Message")
where el.Element("MessageID").Value == MsgID
select el;
This LINQ statement is not working.

Right. What happens if you remove the where clause? Is it successfully
finding the messages themselves when unfiltered? That would also
verify that it's managed to load the document appropriately.

2) After the LINQ found the records, it fail to copy the value to
IEnumerable<XElement> msgs

That's just assignment - pretty unlikely to fail.

As I said, I have tested this code and same LINQ statement on a
desktop console application. It works fine.

Sure. The trick is narrowing down where the difference is :)

Jon
.



Relevant Pages