更新时间:2023-01-31 15:48:30
在.Net中,您不能将 null
值分配给 int
或任何其他结构。相反,请使用 Nullable< int>
或 int?
简称:
In .Net, you cannot assign a null
value to an int
or any other struct. Instead, use a Nullable<int>
, or int?
for short:
int? value = 0;
if (value == 0)
{
value = null;
}
进一步阅读