错误:期望的类,委托,枚举,接口或结构

Art*_*ani 0 c# syntax-error visual-studio-2010

我在下面的代码中收到以下错误:

期望的类,委托,枚举,接口或结构.

鼠标悬停在GH_ObjectResponse上会发生这种情况,我做错了什么?

public class SettingsComponentAttributes : GH_ComponentAttributes
{
    public SettingsComponentAttributes(IGH_Component SettingsComponent) :  
        base(SettingsComponent) {}
}

public override GH_ObjectResponse RespondToMouseDoubleClick(
    GH_Canvas sender, GH_CanvasMouseEvent e)
{
    ((SettingsComponent)Owner).ShowSettingsGui();
    return GH_ObjectResponse.Handled;
}
Run Code Online (Sandbox Code Playgroud)

Gle*_*hes 5

您的方法未在类中声明...请尝试以下方法:

public class SettingsComponentAttributes : GH_ComponentAttributes
{
    public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) { }

    public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
    {
        ((SettingsComponent)Owner).ShowSettingsGui();
        return GH_ObjectResponse.Handled;
    }
}
Run Code Online (Sandbox Code Playgroud)