My LINQ statement looks like
My problem is that neither file.Attribute(Global.xnToKeep). nor file.Attribute(Global.xnProtected) are guaranteed to exist in file. So, I need to test their existence before testing what their value is. How do I do that in a LINQ statement?List<XElement> filteredset
= (from file in matchingsets.Elements<XElement>(Global.xnFile)
where (((string)file.Attribute(Global.xnToKeep).Value != "*") && ((string)file.Attribute(Global.xnProtected).Value != "*") &
& File.Exists(file.Attribute(Global.xnPath).Value))
select file).ToList<XElement>();
View the full article




Sign In
Create Account
Back to top







