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

What is verbatim string literal in c#?

907


What is the difference between static and constant variables?

1004


What is different between Static Constructor and Private Constructor?

932


What is lazy loading c#?

972


How do I do a case-insensitive string comparison?

986


What is data types in c#?

909


What does exclamation mark mean c#?

965


Can I fly with a loop recorder?

880


What are boxing and unboxing?

881


What is difference between code access and role based security?

1016


Can we extend static class in c#?

873


Can a constructor be private in c#?

872


What is string class in c#?

862


Explain the difference between the system.array.copyto() and system.array.clone()?

888


What's the difference between an integer and int?

1010