This code produces a System.ArgumentOutOfRangeException
because numberOfIntervals
is infinity. But why doesn't this produce a divide by zero
exception? The calculation ends up being -524 / 0. Shouldn't that produce a divide by zero
exception?
DateTime startDate = new DateTime(2019, 1, 1);
DateTime referenceDate = new DateTime(2020, 6, 8);
double numberOfIntervals = (startDate - referenceDate).TotalDays / 0;
Console.WriteLine(numberOfIntervals);