Params Arguments


Variable List

You can pass the params keyword to pass a variable list of parameters.
This allows you to pass a variable list of paramaters
Declare your last parameter in your list as an array type

static void VarArgs(int val1, params int[] vals) 
{
   foreach (int I in vals)
   {
   }
}


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext