I remember that I have red somewhere that you can create a method that takes endless arguments. The problem is that I don’t remember how to do it. I remember that it was something like this:
private void method(int arguments...)
{
//method body
}
I’m sure that there was “...“. And I remember that when you call method you could call it like this:
method(3232); or method(123,23,12);
If anyone understands of what I’m talking about please tell me how to do it.
You would use the params keyword:
You could invoke your method like so:
method(1,2,3,4,5,6,7,8,9);and the array would contain those numbers. The params keyword must be on an array, and if it is not the only parameter in the method, it must be the last. Only one parameter can have have the param declaration.