在填写有关 Xamarin Studio 的错误案例之前,我想询问您的意见
public class Class1
{
public int AProp { get; set; }
}
考虑到这个简单的场景
Class1 c;
var aProp = c?.AProp;
不应该像在 Visual Studio 2015+ 上的 c#-6.0 中那样aProp
将其推断为实例吗?int?
因为实际上不是,所以被推断为平原int
。
Xamarin Studio 没有抱怨运算符,但它没有识别aProp
为可空类型,因此抱怨.HasValue
属性评估;不仅是 Intellisense,而且在编译时更糟糕的是
我错过了什么还是只是我的 IDE?
编辑:实际上我刚刚发现我可以在空合并检查中使用它,即使推断的类型实际上是int
!什么混合!XD