In C# why can't a conditional operator implicitly cast to a nullable type
- by Tim Jarvis
I am curious as to why an implicit cast fails in...
int? someValue = SomeCondition ? ResultOfSomeCalc() : null;
and why I have to perform an explicit cast instead
int? someValue = SomeCondition ? ResultofSomeCalc() : (int?)null;
It seems to me that the compiler has all the information it need to make an implicit casting decision, no?