在C#中,我们可以这样做:
然而,以下代码将返回
Int32 i = new Int32();
然而,以下代码将返回
null
:typeof(Int32).GetConstructor(new Type[0])
为什么会这样呢?
我查看了文档,但没有找到为什么会发生这种情况的线索。
下面的代码片段可以说明我的结果:
using System;
public class Program
{
public static void Main()
{
Int32 i = new Int32();
Console.WriteLine(i);
Console.WriteLine(typeof(Int32).GetConstructor(new Type[0]) == null);
}
}
The output is :
0
True