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

Define parsing? Explain how to parse a datetime string?

929


What is .dbml file?

858


What's the implicit name of the parameter that gets passed into the set method/property of a class?

954


What is the difference between early binding and late binding in c#?

920


What is the difference between constants and read-only?

882


What is action c#?

881


Why singleton class is sealed?

898


What exactly is serverless?

804


What is an escape sequence?

892


What is null character in string?

989


Can dictionary have duplicate keys c#?

837


What are c# i/o classes?

987


What does convert toint32 mean?

916


Is hashset serializable c#?

937


What is use of list in c#?

823