Error
Explanation
In order to use these kinds of conditional expressions:
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:
in this case int
is convertible to int?
.