我有时可以分配null到int?但不是里面? :,为什么呢?
例
int? a; // good
int? b; // good
a = null; // why is this allowed?
b = (a != null) ? 1 : null /* and this not allowed? */;
b = (a != null) ? 1 : (int?)null /* this is a fix */;
Run Code Online (Sandbox Code Playgroud)