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 Event - Delegate?
Do loops c#?
In which order the constructor is called for an inherited class?
Explain how to parse a datetime string?
Why do we need dependency injection in c#?
Does c# have its own class library?
What are the string functions in c#?
What is difference between private and protected?
Write a C# program to find the Factorial of n
What are the Types of compatabilities and explain them
What to implement on my class Finalize or IDisposable
Define c# i/o classes?
What is final keyword in c#?
Explain Constructor and destructor?
What is class method?