title: Shortest way to check for age filter in LINQ?
body: <p>I am trying to check for people in a certain range - let lb-lowerbound and ub-upper bound corresponding for e.g. age group with lb=18 and ub=24 meaning I am trying to filter out the people aged between 18 and 24.Also Datetime field in database for date of birth is nullable.I have this code - </p>
  
  <pre><code>var users=from e in employee
            where e.DOB.HasValue &amp;&amp; ((DateTime.Now.Year - e.DOB.Value.Year)) &gt;= lb) 
            &amp;&amp; ((DateTime.Now.Year - e.DOB.Value.Year) &lt;= ub)
            select e;
  </code></pre>
  
  <p>but this is only checks with the year how do I use the month and find out the actual age and filter out the users according to their age ? Thanks everyone for their help.</p>