Pass variable length of argument to a method.
How to pass variable length of argument to a method.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Akkiraju IvaturiRank #473 · 5.3K reputationPosted Aug 24, 2012, 10:01 PM EDT
If you mean any number of arguments, you can use collection as a parameter and process on each item.
Can you clarify a little bit more on this?
VulpesRank #55 · 29.2K reputationPosted Aug 25, 2012, 2:35 AM EDT
satish kumar2 reputationPosted Aug 25, 2012, 4:15 AM EDT
Akkiraju IvaturiRank #473 · 5.3K reputationPosted Aug 25, 2012, 1:05 PM EDT
If you have your method structure, do pass it to me so that I can give you more clear answer
What I understood is as below:
void somemethod(variablelength)
{
}
If so why do not you make the method to accept a int type and then use it. The calling method just have to calculate the length of the argument and pass the length as a parameter along with the arguments or you accept the argument and then find the length in your method.
Anyways, there is some confusion in understanding and so I would recommend you to send the pseudo code to understand your requirement better.