If I have a method:
protected int CalculateActualDuration(DateTime? startDate, DateTime? endDate) { if (startDate.HasValue && endDate.HasValue) { return Math.Abs((int)(endDate.Value.Subtract(startDate.Value).TotalMinutes)); } else { return 0; } }
Can I call a method by passing as a DateTime? and datetime. So how does the compiler understand the difference?
Does this mean that if I pass in a DateTime value, the if statement will be essentially the same as
if (true && true)
and all meaning *. has been changed to the appropriate objects? So all endDate.Value are now EndDates?
Does the compiler provide all parameters that are not Nullables in Nullables at runtime?
source share