You have a list of dates. You want to filter the dates to the current year and then select the highest date.

Which query do you use?

 Posted by Rajkatie on 8/31/2013 | Category: .NET Framework Interview questions | Views: 3742 | Points: 40
Select from following answers:
  1. DateTime result = dates.Where(d => d.Year == DateTime.Now.Year).OrderByDescending(d => d).FirstOrDefault();
  2. DateTime result = dates.Where(d => d == DateTime.Now).OrderBy(d => d).First();
  3. DateTime result = dates.Where(d => d.Year == DateTime.Now.Year).OrderByDescending(d => d).Single();
  4. All Above

Show Correct Answer


Source: microsoft book (c#) | | Alert Moderator 

Comments or Responses

Login to post response