Nullable <DateTime> nullcheck when comparing?
I have the following code
List<DateTime?> dtDates = new List<DateTime?>()
{
null,
DateTime.Today.AddDays(1),
DateTime.Today.AddDays(-1)
};
IEnumerable<DateTime?> result = dtDates.Where(x => x > DateTime.Today);
Why doesn't he need a nullcheck like x.HasValue && x.Value > DateTime.Today
Here is a simplified version of the problem:
bool dtresult = null < DateTime.Today;
bool iresult = null < 6;
Is there a mistake in the comparison method?
+4
No one has answered this question yet.
See similar questions:
or similar: