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

how to Create a datagridview control with check box column with 8rows in it, the maximum number of check boxes checked should be 3, when user checks the 4th corresponding message should be displayed and check box should be checked. User can uncheck the checked boxes Note: read-only property should not be used

2864


What is clr in c#?

828


Why is lazy loading?

856


How do I register my code for use by classic com clients?

871


What are collections in c#?

886


What is int32 maxvalue?

937


What is the difference between “constant” and “readonly” variables in c#?

988


What is jit? What are the different types of jit?

992


How to achieve polymorphism in c#?

949


What is visual c# net?

986


What is difference between destructor and finalize?

904


How does c# generics and c++ templates compare?

901


what is scope of a protected internal member variable of a c# class

999


What is the difference between abstract class and interface in c#?

934


If the original method is not static you can declare an override method to be static or not?

922