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...

can we assign null value to value type in c#?

Answer Posted / ahmad al mursalin

Yes, In C# 2.0 there is introduced one new type called
nullable types. through this we can assign null value in any
value type like...
bool?flag=null;
but before evaluate this value we should check flag value like..
if(!flag.HasValue)
{
flag=true;
}
after that we have to cast bool value to bool like..
if((bool)flag)
{
//write your code.
}

Is This Answer Correct ?    11 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you use foreach iteration on arrays in c#?

1077


Is int a class in c#?

979


Explain About sn.exe

999


What does it mean?

944


Why do I get a "cs5001: does not have an entry point defined" error when compiling?

998


What is hashmap in c#?

972


What is function c#?

919


Describe two uses of the “using” statement during the operation of c#?

965


Explain anonymous type in c#?

962


What is Implementation inheritance

978


How many types of constructor are there in c#?

910


What is command object in c#?

958


What is the difference between inheritance and abstract class?

889


What are access modifiers used for?

1090


What is console readkey ()?

963