Type of conditional expression cannot be determined because there is no implicit conversion between 'int' and '<null>'

Error


Type of conditional expression cannot be determined because there is no implicit conversion between 'int' and '<null>'

Explanation


In order to use these kinds of conditional expressions:

Wrong conditional expression

All the variables must have the same type or must be convertible to that type.
x.Value is an int and int is not convertible to null that's why you are getting the above error.

Solution


One way around this is to make one type convertible to the other:

Correct conditional expression

in this case int is convertible to int?.