c# - How to pass a dynamic number of arguments into a function -


i have situation want pass unknown number of arguments function. function structured as:

public void test(string x, params string[] y) {     //code } 

i need pass unknown number of arguments y input. in cases, may have 2 y's, in others have 20 y's in format of

test("test", arg[0], arg[1], arg[2], arg[3] ... arg[20]); 

any suggestions on how enter varying number of y inputs above function? i'm attempting automate process , c# new me.

you need pass arg:

test("test", arg); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -