I was wondering if it is possible to include inner variables or delegates in linq statements?
I currently am using Linq to XML with XPath extensions and am using a where clause on an element that I cannot guarantee will exist.
Here is a sample of what I mean:
var result =
from record in xml.Root.XPathSelectElements("record")
where ...
select record;
I want the where to be something like:
where
{
var element = record.XPathSelectElement("element[@type='sometype']");
return (element != null && element.Value.Contains("keyword"));
}