also, the special case of 0 is considered.
[Test]
public void TestConvertNullToString()
{
var a = ((string) null);
if (a == null)
{
Console.WriteLine("Hello");
}
else
{
Console.WriteLine("bbb");
}
if (a is string)
{
Console.WriteLine("a is String");
}
else
{
Console.WriteLine("a is not String");
}
if (a is int)
{
Console.WriteLine("a is int");
}
else
{
Console.WriteLine("a is not int");
}
// if ((a as int) == null)
// {
// Console.WriteLine("a is not String");}
//
// }
// else
// {
// Console.WriteLine("a is not String");
// }
int c = 1;
object d = c;
a = ((string) d); // Invalid cast exception
Assert.DoesNotThrow(() => { string.IsNullOrEmpty((string) null); });
}
}
}