How can I replace all DateTime?
s where the date is null
with DateTime.MaxValue
?
I have tried:
Array.ConvertAll(myDateTimeArray, a => a = a.HasValue ? a : DateTime.MaxValue);
and also:
myDateTimeArray.Where(a => a == null).ToList().ForEach(a => a = DateTime.MaxValue);
After that I want to do something like:
DateTime minDate = myDateTimeArray.Min(a => a.Value);
but I am getting an InvalidOperationException
because a.Value
is null
...