Select from following answers:- DateTime result = dates.Where(d => d.Year == DateTime.Now.Year).OrderByDescending(d => d).FirstOrDefault();

- DateTime result = dates.Where(d => d == DateTime.Now).OrderBy(d => d).First();
- DateTime result = dates.Where(d => d.Year == DateTime.Now.Year).OrderByDescending(d => d).Single();
- All Above
This will return the highest date for the current year. If your filter can’t find a value for the current year, it will return ‘1-1-0001 00:00:00’
Show Correct Answer
Source: microsoft book (c#) | |
Alert Moderator