[英]Why can't we find Int32's Default Constructor using GetConstructor?
在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);
}
}
输出是:
0
真正
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.