C#错误:类型'x'已经定义了一个名为'y'的成员,它具有相同的参数类型(C# error: Type 'x' already defines a member called 'y' with the same parameter types)
在Visual C#Express上 ,出现以下错误代码:
'类型'myComponent.SettingsComponent'已经定义了一个名为'SolveInstance'的成员,它具有相同的参数类型'
但我只在那里使用SolveInstance 。 我做错了什么,下次我怎么能自己解决这个问题?
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); } } }On Visual C# Express, I get the following error with the code below:
'Type 'myComponent.SettingsComponent' already defines a member called 'SolveInstance' with the same parameter types'
But I only used SolveInstance there. 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); } } }最满意答案
它看起来像你有两个实例
protected override void SolveInstance(IGH_DataAccess DA)在你的例子类中,一个空的主体和一个代码。
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.
更多推荐
发布评论