错误CS0027:关键字'this'在当前上下文中不可用 - c#

我有以下构造函数的初始化:

public partial class WizardPage1 : WizardPage
{
    public WizardPage1()
        : base(0, getLocalizedString(this.GetType(), "PageTitle"))
    {
    }
}

哪里

public static string getLocalizedString(Type type, string strResID)
{
}

但是this.GetType()部分会导致以下错误:

错误CS0027:关键字“ this”在当前上下文中不可用

知道如何解决吗?

参考方案

this关键字引用该类的当前实例,在构造函数中您没有即时的对象,因此您将要创建一个实例。

public partial class WizardPage1 : WizardPage
{
    public WizardPage1()
        : base(0, getLocalizedString(typeof(WizardPage1), "PageTitle"))
    {
    }
}

将字符串分配给numpy.zeros数组[重复] - python

This question already has answers here: Weird behaviour initializing a numpy array of string data                                                                    (4个答案)         …

R'relaimpo'软件包的Python端口 - python

我需要计算Lindeman-Merenda-Gold(LMG)分数,以进行回归分析。我发现R语言的relaimpo包下有该文件。不幸的是,我对R没有任何经验。我检查了互联网,但找不到。这个程序包有python端口吗?如果不存在,是否可以通过python使用该包? python参考方案 最近,我遇到了pingouin库。

Matplotlib'粗体'字体 - python

跟随this example:import numpy as np import matplotlib.pyplot as plt fig = plt.figure() for i, label in enumerate(('A', 'B', 'C', 'D')): ax = f…

如何在没有for循环的情况下在Javascript中使用Django模板标签 - javascript

我想在JavaScript中使用模板变量:我的问题是在javascript代码中使用for循环,for循环之间的所有事情都会重复..但我不想要....下面粘贴了我的代码..有人可以告诉我更好的方法吗这..因为这看起来很丑..这是我的代码: {% block extra_javascript %} <script src="/static/js…

为什么`if(guess!='a'|| guess!='A'||…)`不起作用? - java

Improve this question 这是我的代码,我知道if语句真的很长,代码可能会更高效,但是我只是想知道答案,因为它使我发疯。while (whileloop == 1) { if (guess != 'a' || guess != 'A' || guess != 'b' || gues…