显然可空< INT>
和 INT
在价值相等的。有什么理由选择一个比其他?
可空< INT>一个=无效;
诠释? B =零;
A == B: // 这是真的
解决方案
没有区别。
? INT
只是简写可空< INT>
,这本身就是速记可空<的Int32>
编译code将完全哪一个您选择使用相同的。
Apparently Nullable<int>
and int?
are equivalent in value. Are there any reasons to choose one over the other?
Nullable<int> a = null;
int? b = null;
a == b; // this is true
解决方案
No difference.
int?
is just shorthand for Nullable<int>
, which itself is shorthand for Nullable<Int32>
.
Compiled code will be exactly the same whichever one you choose to use.