Age range count in roaster

Dear Suport,

I want to range between number fir this itried below process but unfortunatily its not working ,could you please help me.

HH_roster.Count(m=>m.C05>14) && HH_roster.Count(m=>m.C05<35)

Regrads :

Thank You

Cross-posting, see answer Count using several conditions based on Roster (part 2) - #5 by peter_brueck

It doesn’t work because the result of the function Count() is an integer number 0…N and thus the expression you wrote is something like: 5 && 7, which makes no sense in C#:

C# logical operators are widely described in the Internet. See e.g. here.

Besides, even if C# did something like assume logical truth for values different from zero (say, like Stata does) the expression would still be wrong, since it will be true for as long as you’d have in your roster at least one person younger than 35 and at least one person older than 14 (for example, 0 and 100 year olds). This is certainly not what you wanted.

Use the InRange() function for your case, as already advised in Count using several conditions based on Roster (part 2)

Best, Sergiy