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
Update Comments with cell ref.
get 550 5.7.1. Unable to relay for specific domains....
Table Design
How to get all the site names under a sitecollection
Exchange 2010 RPC error
multiple users having outlook and phones checking one IMAP mailbox, is it a problem?
Removing a tidserv backdoor rootkit on XP
Simulate Lan over internet
ASP.NET 2.0 Warning. Event ID 1309 Source ASP.NET.0.50727.0
RequiredFieldValidator Cant validate