【问题标题】:what is class member named Void .ctor() in c# . this is appear when i use GetMethods [duplicate]c# 中名为 Void .ctor() 的类成员是什么。这在我使用 GetMethods 时出现 [重复]
【发布时间】:2017-06-22 07:40:31
【问题描述】:

当我在 Class 上使用 GetType 时,Void .ctor() 出现在 DeclareMembers 上。

但是这个类没有名为 Void .ctor() 的成员。

什么是 Void .ctor()?

【问题讨论】:

  • 类的构造函数。你可以通过GetConstructors()获得它
  • 这是一个默认构造函数。

标签: c# reflection types


【解决方案1】:

它是类的构造函数(在这种情况下是无参数构造函数)。您可以通过Type.GetConstructors() 获得它。如果你找到.cctor,那么它就是类的静态构造函数。

【讨论】:

    猜你喜欢
    • 2015-03-05
    • 1970-01-01
    • 2021-03-30
    • 1970-01-01
    • 2014-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多