How to assign default value to nullable types? Did nested
nullable types are allowed
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / msg
Nested nullable types are not allowed. The following line
will not compile:
Nullable<Nullable<int>> n;
- By MSG
Is This Answer Correct ? | 1 Yes | 2 No |
What is console programming language?
What is xml comments in c#?
what is the difference between .dll and .exe
What is boolean method?
What is called method in c#?
What is the wildcard character in SQL? Let?s say you want to query database with LIKE for all employees whose name starts with La.
can u tell me any one steps for creatting sn.k
What is the name of c# compiler?
What is yield c#?
What is the difference between inheritance and abstract class?
Write a console application and implement the ternary operator to decide whether the age a user entered after being prompted is allowed to vote or not(given that only citizens between 18 and 120 years only inclusive can vote). Use exception handling for non-numerical input.
What is difference between string and stringbuilder in c#?