Issue
int value=0;
if (value == 0)
{
value = null;
}
How can I set value
to null
above?
Any help will be appreciated.
Solution
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
Answered By - p.s.w.g Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.