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
having trouble installing SP3 for Exchange Server 2007 before installation begins
ASP.NET: "Invalid object name" in GridView SqlDataSource
asp - The resource could not be found
Email Marketing Reseller Solution
Remove header from array created using Get-QADComputer cmdlet?
MS SQL count total time.
Network Range of IPs and what is available.
Send Mail via Google Apps
Detect dual monitor via javascript
Router Sessions