Problem using Conditional Operation with Nullable Int
- by Rajarshi
A small problem. Any idea guys why this does not work?
int? nullableIntVal = (this.Policy == null) ? null : 1;
I am trying to return 'null' if the left hand expression is True, else 1. Seems simple but gives compilation error -
Type of conditional expression cannot be determined because there is no implicit conversion between 'null' and 'int'
If I replace the " ? null : 1 " with any valid int, then there is no problem.