I have a method foo(params[] items)
I have a collection (List, Set, …)
I want to send its items to foo as items
what syntax can I use?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you pass array as only param it will be passed as items. So just use
Collection.ToArray. Actually there is something good to know about when you’re usingparams. If you pass null with intention to pass it as first and only param it will be used as null array. So with code like this:Items will be null, not
arraywith length of 1 andnullas first elem.