Just replace .Where()with .Any()to create a true / false boolean condition:
query.And(x => x.listb.Any(b => b.val3 == 1));
This will return all records Awhere any element in listbcontains val3of 1. If you only want to Awrite down where all the elements in listbmatch the condition, use .All():
query.And(x => x.listb.All(b => b.val3 == 1));
source
share