[Webinar] Streamline your web hosting managementRegister Today


passing a lot of  parameters to the methods?

Posted on 2012-08-17
Medium Priority
Last Modified: 2012-08-20

I have this vb.net application which takes in a lot of input parameters does calculations.
All these methods I have are calculations.
Some of those parameters are array. The number of parameters ranges from 4-20.

1) What's starndard as far as passing parameters?

2) so i am trying to create classes and pass the class objects instead?

Any advise  or suggestion about passing the parameters to the methods?
Question by:dkim18
LVL 61

Assisted Solution

by:Julian Hansen
Julian Hansen earned 1000 total points
ID: 38304958
Using an object to pass parameters is in my opinion the better way to go - it is far more extensible if you need to change in the future and allows you to chain calls from one function to the other without having to deal with messy parameters lists - or change them if things change in the future.
LVL 40

Accepted Solution

Jacques Bourgeois (James Burger) earned 1000 total points
ID: 38307165
It depends on what you exactly intends to do.

Creating a class as suggested is very often the best way to go. But it can lead to deployment headaches if the method is in a dll shared by more that on application.

There are alternatives that are sometimes easier to implement and can also make things easier in some update scenarios. Look up Optional Parameters and ParamArray in online help. Office VBA has been built that way and has been living for many many version over more than 20 years.

The class is probably the first option to consider. But you should not disregard the alternatives. The use of one over the others is dependant on what you intend to do now and how you expect the application to evolve in future versions.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Native ability to set a user account password via AD GPO was removed because the passwords can be easily decrypted by any authenticated user in the domain. Microsoft recommends LAPS as a replacement and I have written an article that does something …
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question