如何在C#方法中使用引用 [英] How to use reference in a c# method

查看:334
本文介绍了如何在C#方法中使用引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

valid = ValidStageTransition(currentStageId, stageTransId, endReasonId,out preverify,out _list, out currentCSE,out ste)



我希望该方法基于ID来执行某些操作吗?它已经编写了代码.现在,我添加了两个变量_list和bool preverify.因为我想将内容添加到列表中.但它抱怨像

错误1 ValidStageTransition(int,int,int,bool,out System.Collections.Generic.Dictionary< string,string>,CaseStageEntity,Apption.CMS.LLBL.CHRC.EntityClasses.StageTransitionEntity)的最佳重载方法匹配''有一些无效的参数

错误2错误2不应使用关键字"out"传递参数"4".



I want that method to do some thing based on the id right?. Its already written code. Now I added the two variables _list and bool preverify. Because i want to add things to the list right. but it complains like

Error 1 The best overloaded method match for ValidStageTransition(int, int, int, bool, out System.Collections.Generic.Dictionary<string,string>, out CaseStageEntity, out Apption.CMS.LLBL.CHRC.EntityClasses.StageTransitionEntity)'' has some invalid arguments

error 2 Error 2 Argument ''4'' should not be passed with the ''out'' keyword

推荐答案

没有看到ValidStageTransition的实际方法签名,我想preverify不应该作为out参数传递,所以应该代替:

Without seeing the actual method signature for ValidStageTransition, I guess that preverify shouldn''t be passed as an out parameter, so instead of:

valid = ValidStageTransition(currentStageId, stageTransId, endReasonId,out preverify,out _list, out currentCSE,out ste)



您会写:



You''d write:

valid = ValidStageTransition(currentStageId, stageTransId, endReasonId, preverify, out _list, out currentCSE, out ste);


看看第二个错误,这就是解决问题的方法.

错误2错误2参数"4"不应与关键字"out"一起传递"

您需要删除"preverify"参数上的out关键字.
Look at the second error, it is how you resolve your problem.

"error 2 Error 2 Argument ''4'' should not be passed with the ''out'' keyword"

You need to remove the out keyword on the "preverify" argument.


这篇关于如何在C#方法中使用引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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