J
John Smith
I'm wondering why the following code do not throw a null exception?
In the third line I set s to null (make it to point nowhere), however later
I can call it's IsNull property.
AFAIK, if I set a reference-type variable to null, I cannot call anything on
that.
Can somebody explain this? (It can be technical as well)
Thanks,
//////////
SqlString s = new SqlString();
s = "Dummy";
s = null;
if (s.IsNull == true)
{
Console.WriteLine("s is null");
}
else
{
Console.WriteLine("s is not null");
}
//////////
In the third line I set s to null (make it to point nowhere), however later
I can call it's IsNull property.
AFAIK, if I set a reference-type variable to null, I cannot call anything on
that.
Can somebody explain this? (It can be technical as well)
Thanks,
//////////
SqlString s = new SqlString();
s = "Dummy";
s = null;
if (s.IsNull == true)
{
Console.WriteLine("s is null");
}
else
{
Console.WriteLine("s is not null");
}
//////////