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
Can you use foreach iteration on arrays in c#?
Is int a class in c#?
Explain About sn.exe
What does it mean?
Why do I get a "cs5001: does not have an entry point defined" error when compiling?
What is hashmap in c#?
What is function c#?
Describe two uses of the “using” statement during the operation of c#?
Explain anonymous type in c#?
What is Implementation inheritance
How many types of constructor are there in c#?
What is command object in c#?
What is the difference between inheritance and abstract class?
What are access modifiers used for?
What is console readkey ()?