gpt4 book ai didi

c# - 获取当前类的名称

转载 作者:行者123 更新时间:2023-11-30 14:13:12 25 4
gpt4 key购买 nike

我有以下类(class):

public class dlgBoughtNote : dlgSpecifyNone
{
public com.jksb.reports.config.cases.BoughtNoteReport _ReportSource;

public dlgBoughtNote()
{
btnPreview.Click += new EventHandler(Extended_LaunchReport);
this.Text = "Bought Note Print";
}

protected override void InitReport()
{
_ReportSource = new com.jksb.reports.config.cases.BoughtNoteReport(null);
ReportSourceName = _ReportSource;
}
}

从技术上讲,如果我调用以下构造函数 dlgBoughtNote()

public dlgBoughtNote()
{
btnPreview.Click += new EventHandler(Extended_LaunchReport);
this.Text = "Bought Note Print";
MessageBox.Show(this.Name);
}

我应该得到“dlgBoughtNote”的结果,但我得到的是“dlgSpecifyNone”。除了我正在做的方式之外,还有什么方法可以获得当前类(class)的名称。

最佳答案

获取当前类名称的最简单方法可能是 this.GetType().Name

关于c# - 获取当前类的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14889978/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com