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
Describe the ways of cleaning up objects in c#.
What is the difference between int.parse and int.tryparse methods?
Can you specify nested classes as partial classes?
What is c# used for in the industry?
Describe how a .net application is compiled and executed
What does this keyword mean in c#?
What is default class in c#?
Explain how to implement an object pool in c#.net
Which namespace is required to implement trace ?
What is a shared assembly?
Is and as keyword in c# net?
What are c# collections?
Explain the difference between .net and c#?
What is method and function in c#?
Can you create sealed abstract class in c#?