title: Using only the year part of a date for a WHERE condition
body: <p>In the LINQ statement below, I want to select people with an exam date in 2010. The exam date is stored as a datetime as the actual date and time is used in other applications. What is the most elegant, easiest, best way to compare the exzam date to only '2010'. Or, should I just compare, using >=, the exam date to 1/1/2010?</p>
  
  <pre><code>var active = dc.People.Where(x =&gt; x.exam &gt;= 2010)
          .Select(x =&gt; new {x.ContactID, x.FirstName, x.LastName})
                     );
  
  x.MostRecent == DateTime.Parse("1/1/2010").Year
  </code></pre>
  
  <p>EDIT #1</p>
  
  <p>I thought I should see a .Year on the exam date but I didn't. After seeing a couple of posts here I went back and found this works...</p>
  
  <pre><code>.Where(x =&gt; x.exam.Value.Year == 2010)
  </code></pre>
  
  <p>Why is .Value necessary to access .Year? Exam is a nullable datetime.</p>