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

Why cannot you specify the accessibility modifier for methods inside the interface?

971


in object oriented programming, how would you describe encapsulation?

1085


What are the different types of assemblies available and their purpose?

952


Is c# a keyword?

978


How does dll hell solve in .net?

1012


What is the concept of strong names?

1030


List some of the basic string operation?

982


What is the syntax for calling an overloaded constructor within a constructor?

1004


What is the difference between Singleton design pattern and Factory design pattern?

1010


How to assign Null value to Var?

1034


Differentiate between sqlclient oledb and providers?

1010


What are the new features in c# 2.0?

1029


What does void mean in c#?

1038


What is lazy t?

1009


Explain deadlock?

1076