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
What does dbml mean?
Why to use lock statement in c#?
What are c# collections?
What is a datacontract?
Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?
What is the advantage of constructor?
What is the difference between finalize() and dispose() methods?
What is int tryparse in c#?
What's new in c#?
Can abstract class be sealed?
What is ado c#?
What is sorting in c#?
How do I open the console window?
How to reverse each word in a string using c#?
Expalin the way you implement inheritance by using VB.NET/C#?