Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to assign default value to nullable types? Did nested
nullable types are allowed

Answers were Sorted based on User's Feedback



How to assign default value to nullable types? Did nested nullable types are allowed..

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

How to assign default value to nullable types? Did nested nullable types are allowed..

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

Post New Answer

More C Sharp Interview Questions

Is c# pass by value?

0 Answers  


What .exe means?

0 Answers  


Are cao stateful in nature?

0 Answers  


Why should I use interface in c#?

0 Answers  


What is stringreader in c#?

0 Answers  


Why multiple inheritance is not possible in c#

8 Answers  


What is the difference between struct and class in c#?

3 Answers  


What is a statement c#?

0 Answers  


Why to use “using” in c#?

0 Answers  


What is stringbuilder c#?

0 Answers  


What is the use of delegate?

0 Answers  


What are assemblies?

0 Answers   Microsoft,


Categories