没有任何参数对应于所需的形式参数'info' [英] There is no argument given that corresponds to the required formal parameter 'info'

查看:70
本文介绍了没有任何参数对应于所需的形式参数'info'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VS C#项目(project1)编译并且工作正常,没有任何错误。我创建了第二个项目(project2),它添加了许多文件作为第一个项目的链接。我添加了所有必要的引用等。我为project2创建了一个条件编译符号。 Project2给出了一个错误:

没有给出的参数对应于'Curve.Curve(SerializationInfo,StreamingContext)'所需的形式参数'info'


I have a VS C# project (project1) that compiles and works fine without any errors. I have created a second project (project2) that adds a number of files as links from the first project. I've added all the necessary references etc. I've created a conditional compilation symbol for project2. Project2 is giving one error:
There is no argument given that corresponds to the required formal parameter 'info' of 'Curve.Curve(SerializationInfo, StreamingContext)'

 public CurveCollection(List<Rhino.Geometry.Curve> curves) 
{
     this.CurveList = this.CurveList;            
}



我在论坛中搜索过,试图找出导致此错误的原因,我不知所措。

有人可以了解我可能缺少的东西吗?



我尝试过的事情:



我在论坛中搜索过,试图找出造成这个错误的原因,我不知所措。我已经尝试重新链接文件,但这并没有解决问题。


I've searched through the forums to try and find why this error is being caused, and I'm at a loss.
Can someone shed some light on what I may be missing?

What I have tried:

I've searched through the forums to try and find why this error is being caused, and I'm at a loss. I've tried relinking the file but that didn't solve the issue.

推荐答案

this.CurveList = this.CurveList; 





您(可能)为自己分配(通用)列表;没有初始化;触发需要参数的构造函数。



你可能想:





You're (probably) assigning a (generic) list "to itself"; which is not initialized; triggering constructors that require parameters.

You probably wanted to:

this.CurveList = curves;


我不相信你展示的代码是错误的位置,或者是否是您正在查看相同版本的文件。



错误表示您正在尝试创建一个Curve实例,并且该类只有一个正式的构造函数,至少需要一个参数,这是一个SerializationInfo对象 - 可能是你试图使用一个不存在的无参数构造函数来构造它。

但是那个代码 - 尽管你什么都不做,除非你对CurveList属性setter非常不愉快并且开始在其中构造对象 - 没有显示任何Curve实例的使用。它所做的就是为自己设置一个值并完全忽略形式参数值。



我首先想知道你在做什么:添加一些文件作为来自另一个项目的链接不是我要去的方式 - 我将整个项目作为参考添加,然后直接使用它的对象,这样就不会出现不兼容更改的风险。我怀疑是文件链接ty =你认为你已经建立的实际上是副本,而且它们不再是相同的 - 所以你认为你引用的行看错误不是什么(或者哪里) )你相信它是......
I'm not convinced that the code you show is where the error is, or if it is that you are looking at the same version of the files.

The error is saying that you are trying to create a Curve instance, and the class has only a formal constructor that requires at least one parameter, which is a SerializationInfo object - presumably you are trying to construct it using a parameterless constructor which doesn't exist.
But that code - despite doing nothing at all unless you have got very unpleasant with the CurveList property setter and started constructing objects in it - doesn't show any use of Curve instances. All it does is set a value to itself and ignore the formal parameter value completely.

I'd start by wondering exactly what you are doing: "adding a number of files as links from another project" is not the way I would go - I'd add the whole project as a reference and then use it's objects directly so there is less risk of incompatible changes occuring. What I suspect is that the "file links" ty=you think you have established are actually copies, and they aren't the same any more - so the line you think you are referencing to look at the error is not what (or where) you believe it is ...


这篇关于没有任何参数对应于所需的形式参数'info'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆