In my program i have a database with a table containing persons.
Every person has a collection of clothes, which has a collection of fabrics. Say i want to return the number of persons who has clothes that contain cotton.
I only want to count them once even if the person has more than one clothes that contain cotton.
I tried the following and several other solutions but it didn't quite work out for me:
if ((from p in context.Persons
from c in p.Clothes
from f in c.Fabrics
select f.Name == "Cotton").Count();
{