C#错误:类型'x'已经定义了一个名为'y'的成员,它具有相同的参数类型(C# error: Type 'x' already define

编程入门 行业动态 更新时间:2024-10-23 12:32:24
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.

更多推荐

本文发布于:2023-04-28 03:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329801.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:类型   定义   成员   错误   参数

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!