错误:预期的类,委托,枚举,接口或结构 [英] Error: expected class,delegate,enum,interface or struct
本文介绍了错误:预期的类,委托,枚举,接口或结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误下面的代码:
预期类,委托,枚举,接口或结构
块引用>
这发生在盘旋的 GH_ObjectResponse ,我究竟做错了什么?
$ b $时b公共类SettingsComponentAttributes:GH_ComponentAttributes
{
公共SettingsComponentAttributes(IGH_Component SettingsComponent):
基(SettingsComponent){}
}
酒店的公共覆盖GH_ObjectResponse RespondToMouseDoubleClick(
GH_Canvas发件人,GH_CanvasMouseEvent E)
{
((SettingsComponent)所有者).ShowSettingsGui();
返回GH_ObjectResponse.Handled;
}
解决方案您方法不中声明类...试试这个来代替:
公共类SettingsComponentAttributes:GH_ComponentAttributes
{
公共SettingsComponentAttributes( IGH_Component SettingsComponent):基地(SettingsComponent){}
公众覆盖GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas发件人,GH_CanvasMouseEvent E)
{
((SettingsComponent)所有者).ShowSettingsGui();
返回GH_ObjectResponse.Handled;
}
}
I get the following error on the code below:
expected class,delegate,enum,interface or struct.
This happens when hovering on GH_ObjectResponse, what am I doing wrong?
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; }
解决方案Your method is not declared inside the class... try this instead:
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; } }
这篇关于错误:预期的类,委托,枚举,接口或结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文