How to assign default value to nullable types? Did nested
nullable types are allowed
Answer Posted / msg
Here we have two ways to assign a default value.
1. By using Nullcoalsce(??) Operartor
2. by using getvalueordefault() Method.
ex: int? a= null;
int b = a ?? 10;
Or
int b =a.getvalueordefault(); //if null will return zero
or
int b = a. getvalueordefault(10);// if null will retrun 10
--Nested nullable types are NOT Allowed
-By MSG
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Define parsing? Explain how to parse a datetime string?
What is .dbml file?
What's the implicit name of the parameter that gets passed into the set method/property of a class?
What is the difference between early binding and late binding in c#?
What is the difference between constants and read-only?
What is action c#?
Why singleton class is sealed?
What exactly is serverless?
What is an escape sequence?
What is null character in string?
Can dictionary have duplicate keys c#?
What are c# i/o classes?
What does convert toint32 mean?
Is hashset serializable c#?
What is use of list in c#?