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

Tell us something about static linking and dynamic linking?

0 Answers   C DAC,


What are the different types of delegation?

0 Answers  


How to make a class non-inheritable other than sealed?

7 Answers  


Explain the difference between “system.array.clone()” and “system.array.copyto()” in c#?

0 Answers  


What is difference between ienumerable and enumerable in c#?

0 Answers  


How many types of inheritance are there in c#?

0 Answers  


In which format you can pass the value in the sleep function?

0 Answers  


Can you declare the override method static while the original method is non-static?

2 Answers   Mind Tree,


Why are c# strings immutable?

0 Answers  


what are the benefits in using c# ?

1 Answers  


What are assemblies?

0 Answers   Microsoft,


What is the Signification of the "new " keyword in C#? example

0 Answers   Wipro,


Categories