Microsoft
Software
Hardware
Network
Question : Check for nulls to stop the error - Nullable object must have a value
In the line of code below I want to check if nothing is being passed to User.longVal to stop the error
"Nullable object must have a value"
User.longVal = (double)CurrentUser.longVa
l;
So if nothing is in the
(double)CurrentUser.longVa
l
I want to set a default value -
Do I use the ?? directive
Answer : Check for nulls to stop the error - Nullable object must have a value
I believe it should be something like (C# only):
1:
User.longVal = (double)CurrentUser.longVal ?? default_value;
Random Solutions
Read data from registry key not working
Hyper-V server 2008 R2
Visual studio Team System
Resolve User Name Display Issue and Change Admin PWD in Windows Server 2003
ACT Sage, reattach a database that has already been re-created possible?
SBS2008 migration to Windows 2008 Std
Multi-Site, single IP and DNS records
FAXCOOLWAREZ037 192.168.1.38 00-1A-73-C3-39-8A
Server does not boot
ASA 5505 DMZ won't Access Internet