This code is supposed to return all the records where the month component of the DateCreated is equal to the specified MonthIssued value. The problem is, if DateCreated is DBNull I will get a runtime exception which requires the extra If ternary operator. Any way around this / will this cause a performance hit the code is actually executed?
resultSet = resultSet.Where(Function(d) If(d.a.DateCreated.HasValue, If(d.a.DateCreated.Value.Month = MonthIssued, True, False), False))
Instead of using ternaries, try using the short-circuiting
AndAlsological operator: