Key points of the params array
The params in the C # development language is a keyword that can specify method parameters that take parameters at variable number of arguments. Useful when the number of arguments to a function is variable and the code being executed is very small!
1 class Program2 {3 Static voidMain (string[] args)4 {5Sum (1,2,"a");6 Console.readkey ();7 }8 Static voidSum (params Object[] numstack)9 {Ten for(inti =0; i < numstack.length; i++) One { A Console.WriteLine (Numstack[i]); - } - } the}
The 1.params keyword cannot be used on multidimensional arrays.
1 Public Static Min (paramsint[,],table)...
2. You cannot use the overloaded method with only the params.
1 Public Static int Min (int[] paramlist)
2 Public Static int Min (paramsint
3 The ref and out pass params are not allowed to be used simultaneously
1 Public Static int Min (refparamsint[] paramlist)
... 2 Public Static int Min (outparamsint[] paramlist)
......
4.params array must be the last parameter
1 Public Static int Min (paramsint[] paramlist,int i)//error
5. No params method priority is higher than the priority with the params method
1 Public Static int Min (int lefthandside,int righthandside)2publicstatic int Min (paramsint[] paramlist)
C # params keyword