Tuesday, December 15, 2009

type of conditional expression cannot be determined because there is no implicit conversion between null and bool

Have you seen this?
Type of conditional expression cannot be determined because there is no implicit conversion between null and bool

I received this because I was doing an inline if statement (ternary I think) setting the value to a boolean. The boolean value I was setting was nullable. And, because I did want to set the value to null in some cases, this error was showing. To fix it, I just did the following (bool?)null. Then it all worked out

No comments: