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
What is the use of oops in c#?
What is cache memory in c#?
What is toint32 c#?
What is msil in c#?
Is it possible to have different access modifiers on the get/set methods of a property?
What is the difference between as and is operators in c#?
Are c# constructors the same as c++ constructors?
What are the properties of a string class?
What's the difference between an integer and int?
Is there hashmap in c#?
How to use the sreamReader class to read form a text file?
What is generic in c#?
What are boxing and unboxing?
Write a program in c# to find the angle between the hours and minutes in a clock?
How is a strongly-named assembly different from one that isn’t strongly-named?