[英]C# error: Type 'x' already defines a member called 'y' with the same parameter types
On Visual C# Express , I get the following error with the code below: 在Visual C#Express上 ,我使用下面的代码得到以下错误:
'Type 'myComponent.SettingsComponent' already defines a member called 'SolveInstance' with the same parameter types' 'type'myComponent.SettingsComponent'已经使用相同的参数类型定义了一个名为'SolveInstance'的成员'
But I only used SolveInstance
there. 但我只在那里使用SolveInstance
。 What am I doing wrong and how would I be able to solve this on my own next time? 我做错了什么,下次我怎么能自己解决这个问题?
namespace myComponent
{
public class SettingsComponent : GH_Component
{
protected override void SolveInstance(IGH_DataAccess DA)
{
}
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{
}
protected override void SolveInstance(IGH_DataAccess DA)
{
if (m_settings == null)
{
AddRuntimeMessage(warning, "You must declare some valid settings");
return;
}
DA.SetData(0, m_settings);
}
}
}
It looks like you have two instances of 看起来你有两个实例
protected override void SolveInstance(IGH_DataAccess DA)
in your example class, one with an empty body and one with code. 在您的示例类中,一个具有空主体,另一个具有代码。
Try to find all occurences of SolveInstance in the project. 尝试在项目中找到所有出现的SolveInstance。 You will possibly find another definition of this method in a .designer.cs file. 您可能会在.designer.cs文件中找到此方法的另一个定义。 They are autogenerated and sometimes they cause duplicity problems. 它们是自动生成的,有时会导致重复性问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.