vb.net - Function or Method with unknown number of parameters -


is there way create method unknown number of parameters?

and if case :

  • how possible access them within method?
  • do have same type?

yes & yes.

it possible, , of them must same type, if need pass various types use object datatype instead, , unbox them within function. use paramarray:

' accept variable number of arguments  function sum(byval paramarray nums integer()) integer    sum = 0     each integer in nums      sum +=    next  end function   ' or use return statement c#  dim total integer = sum(4, 3, 2, 1)   ' returns 10 

for more info see this


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -