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
Why do we write system in c#?
What is the difference between list and dictionary in c#?
How to find type of variable?
Is and as keyword in c# net?
How do you escape a character?
What is difference between array and collection?
Why do we need delegates?
How do I use the 'using' keyword with multiple objects?
Are c# references the same as c++ references?
What is bitwise operator in c#?
What are the types of parameters in c#?
What are satellite assemblies?
What are get and set in c#?
What is a destructor in c#?
Can a struct have a default constructor (a constructor without parameters) or a destructor in c#?