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 cannot you specify the accessibility modifier for methods inside the interface?
in object oriented programming, how would you describe encapsulation?
What are the different types of assemblies available and their purpose?
Is c# a keyword?
How does dll hell solve in .net?
What is the concept of strong names?
List some of the basic string operation?
What is the syntax for calling an overloaded constructor within a constructor?
What is the difference between Singleton design pattern and Factory design pattern?
How to assign Null value to Var?
Differentiate between sqlclient oledb and providers?
What are the new features in c# 2.0?
What does void mean in c#?
What is lazy t?
Explain deadlock?