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;
}
Further Reading
- Nullable Types (C# Programming Guide)
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;
}
Further Reading