Resharper suggested I change this code:
if (getBeginDate)
{
return (DateTime)RptParamsFromDate;
}
...to this:
if (getBeginDate)
{
if (RptParamsFromDate != null) return (DateTime)RptParamsFromDate;
}
...because, "Possible 'System.InvalidOperationException'" but when I accepted the suggested change, it doesn't compile, saying, "not all code paths return a value"
The "if" block has a following "else":
else
{
int daysToAddToToDate = DateTime.DaysInMonth(RptParamsToDate.Value.Year, RptParamsToDate.Value.Month) - 1;
RptParamsToDate = RptParamsToDate.Value.AddDays(daysToAddToToDate);
return (DateTime)RptParamsToDate;
}
...so I don't know why it doesn't see the "else" as making sure a value is returned.