I am trying to find a first element from an xml file using the
following code
XElement t = xml.Descendants ("Element").Fir st();
This works fine, but when there is no result set ofcourse the first
method call bombs. I can always split the statement into two and check
if there are any elements available before I pick the first element.
Is it possible to do it in a single statement?
something like the following
from e1 in xml.Decendants( "Element")
select top 1;
Thanks.
following code
XElement t = xml.Descendants ("Element").Fir st();
This works fine, but when there is no result set ofcourse the first
method call bombs. I can always split the statement into two and check
if there are any elements available before I pick the first element.
Is it possible to do it in a single statement?
something like the following
from e1 in xml.Decendants( "Element")
select top 1;
Thanks.
Comment