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

Describe the ways of cleaning up objects in c#.

851


What is the difference between int.parse and int.tryparse methods?

992


Can you specify nested classes as partial classes?

912


What is c# used for in the industry?

826


Describe how a .net application is compiled and executed

867


What does this keyword mean in c#?

862


What is default class in c#?

864


Explain how to implement an object pool in c#.net

894


Which namespace is required to implement trace ?

915


What is a shared assembly?

918


Is and as keyword in c# net?

910


What are c# collections?

839


Explain the difference between .net and c#?

880


What is method and function in c#?

930


Can you create sealed abstract class in c#?

824