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
C# WMI query for getting current logged on user doesn't work on Windows 7
Problems moving L2L IPSec VPN from Cisco PIX to Cisco ASA 5520, connecting from Cisco 877
Looking for Video Recording Software for Samsung Cameras
Database Driven Website
'System.Xml.Linq' doesn't contain any public member
SSIS Case Statement not executing
Enabling bluetooth in Ubuntu 10.04
sum by date and variable (horizontal)
Problem with autodiscover with Outlook 2007/Exchange 2003
How to alter web page so Google Chrome will clear old data?