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
Wyse thin client and Citrix display/graphic lag
NPS Accounting Report for VPN Connections
Comparison Netgear ReadyNAS vs. Buffalo Terastation
ColdFusion/SQL Procedure Undefined Variable Problem
Watchguard XTM 505 or FIREBOX X550E - is it too soon to jump?
Reading bits in C++
Silverlight ContentPresenter in Button Template
Group and ungroup a password-protected sheet?
SQL 2k Database restore using only MDF flies
Best way to setup a shared calendar and contacts on Exchange Server 2003