??? o = new ???();
Console.WriteLine("ToString() -> " + o.ToString() ); //<--- Prints 'ToString() -> '
Console.WriteLine("GetType() -> " + o.GetType()); //<--- NullReferenceException
输出:
ToString() ->
Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object.
at System.Object.GetType()
at Program.Main(String[] args)
???
类型是什么?为什么o.ToString()
返回string.Empty
和o.GetType()
会引发NullReferenceException
?
注意:
GetType()
类型未重新定义???
。