C# 错误:应为类、委托、枚举、接口或结构
我在下面的代码中遇到以下错误: 应为类、委托、枚举、接口或结构 当将鼠标悬停在GH_ObjectResponse上时会发生这种情况,我做错了什么C# 错误:应为类、委托、枚举、接口或结构,c#,visual-studio-2010,syntax-error,C#,Visual Studio 2010,Syntax Error,我在下面的代码中遇到以下错误: 应为类、委托、枚举、接口或结构 当将鼠标悬停在GH_ObjectResponse上时会发生这种情况,我做错了什么 public class SettingsComponentAttributes : GH_ComponentAttributes { public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) {
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;
}
您的方法未在类内声明。。。请尝试以下方法:
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;
}
}
您的方法未在类内声明。。。请尝试以下方法:
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;
}
}
小心你的支架。应该是:
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;
}
}
小心你的支架。应该是:
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;
}
}