If you really want to use linq for this, you can try something like this:
bool isMatching = (from prop in typeof(ParsedTemplate).GetProperties() where typeof(Details).IsAssignableFrom(prop.PropertyType) let val = (Details)prop.GetValue(parsedTemplate, null) where val != null && !val.IsExist && val.Priority == "high" select val).Any();
It works on my car.
Or in the syntax of the extension method:
isMatching = typeof(ParsedTemplate).GetProperties() .Where(prop => typeof(Details).IsAssignableFrom(prop.PropertyType)) .Select(prop => (Details)prop.GetValue(parsedTemplate, null)) .Where(val => val != null && !val.IsExist && val.Priority == "high") .Any();
source share