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

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


Please Help Members By Posting Answers For Below Questions

What is Event - Delegate?

1126


Do loops c#?

944


In which order the constructor is called for an inherited class?

1114


Explain how to parse a datetime string?

970


Why do we need dependency injection in c#?

976


Does c# have its own class library?

1022


What are the string functions in c#?

1016


What is difference between private and protected?

1039


Write a C# program to find the Factorial of n

1028


What are the Types of compatabilities and explain them

1060


What to implement on my class Finalize or IDisposable

1026


Define c# i/o classes?

975


What is final keyword in c#?

1056


Explain Constructor and destructor?

1013


What is class method?

1035