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 string pool in c#?
Explain circular reference in c#?
Is comparator a functional interface?
What?s a satellite assembly?
Describe two uses of the “using” statement during the operation of c#?
How much time will it take to learn unity?
What is token in c#?
Why is c# better than java?
Can we inherit sealed class in c#?
What are the Types of assemblies that can be created in dotnet
Why is the XML InfoSet specification different from the Xml DOM? What does the InfoSet attempt to solve ?
What are examples of desktop applications?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)