Testing... The following statement does not compile because there is no implicit conversion between null
.
CS0173 The type of the conditional expression cannot be determined because there is no implicit conversion between
'<NULL>'
and'<NULL>'
string pp = true ? null : null;
The ternary operator needs to determine the type of the conditional expression. This is done by following the following points that appear in the language specification :
The problem is that
null
it has no type, so since neither part of the expression can determine a type, the error occurs.To solve it, you simply have to assign a type to any of the two expressions, for example: