Possible Duplicate:
Nullable types and the ternary operator: why is `? 10 : null` forbidden?
I want to assign a value or null value to x (which is a nullable integer) according to a case (you can see below)
int? x;
x = stackoverflow.ToString() != "" ? int.Parse(stackoverflow.ToString()) : null;
But it gives below error.
Type of conditional expression cannot be determined because there is no implicit conversion between 'int' and '<null>'
Why?
Cast the int to a nullable int.