导出到dll的类没有构造函数体

时间:2013-07-20 15:39:33

标签: c# class dll constructor

在内部使用单个POCO编译dll时遇到问题,让我们说:

public Person
{
    public Guid PersonId { get; set; }
    public Person()
    {
        this.PersonId = Guid.NewGuid();
    }

}

当我将已编译的dll连接到另一个项目时,我的类看起来像

public Person
{
    public Guid PersonId { get; set; }
    public Person();
}

构造函数体在哪里?我错过了什么吗?

P.S。 Project Runtime是v.4.5,而DLL是v4.0

1 个答案:

答案 0 :(得分:2)

您实际上并没有使用对象浏览器查看源代码,只查看描述成员签名的元数据。

因此,仅查看成员签名是完全正常的。

要查看方法中的代码,您需要使用像ildasm或dotPeek或Red Gate Reflector这样的反汇编程序。