Friday, January 11, 2008

Quiz of the day

What is the output of

static void Main(string[] args)
{

int? x = 20;
int? y = null;
int? z = x ?? y;

Console.WriteLine(z);
Console.ReadLine();

}

And why. What is the difference between

int x and int? x


Now, if we can say

int? element2;

//some code

If (element2.HasValue)
//Do something

What is the use of HasValue property?

No comments: