如何将这些变量作为单个变量传递给c#中的集合或数组? [英] How to pass these variable as single variable like collection or array in c#?

查看:245
本文介绍了如何将这些变量作为单个变量传递给c#中的集合或数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public OSCACSTemplateForm(int iUID, int intCompanyCode, string strCommunitytag, string GetDTCode, string strPosition, List<string> collChecked, string filename, string AccCentre, string Currency, string BankName, DateTime FromDate, DateTime ToDate, string DocNo, String ChqNo, string strTag, string GetDocUid, string GetUDPLocation, string GetUDPNo, int iAuditNo)


OSCACSTemplateForm Templatefrom = new OSCACSTemplateForm(intUID, iCompanyCode, chrTag, intDTCode, Template, objDocumentList, filename, AccCentre, Currency, BankName, FromDate, ToDate, DocNo, ChqNo, "", DocUid, UDPLocation, strUDPNo, getiAuditNo);





我尝试了什么:



如何将这些变量作为单个变量传递,如集合或c#中的数组?(Windows窗体)



What I have tried:

How to pass these variable as single variable like collection or array in c#?(Windows Forms)

推荐答案

如果我正确理解你的问题,问题是这个构造函数有太多参数,想要缩短构造函数调用。



从理论上讲,你可以将带有所需参数的类传递给构造函数,甚至可以像
Hi, if I understand your question correctly the problem is that you have too many parameters for this constructor and want to shorten the constructor call.

In theory you could pass a class with the desired parameters to the constructor or even something like
Dictionary<string,>

但老实说,我没有看到这一点,因为你必须填写该类或col在将其转发给此类构造函数之前进行操作。

but I honestly don't see the point as you would have to fill that class or collection before forwarding it to this class constructor.


这篇关于如何将这些变量作为单个变量传递给c#中的集合或数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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