So I have this code here :
int n;
public static void Main(string[] args)
{
Console.Write("Please insert a number : ");
n = int.Parse(Console.ReadLine());
Console.Write("Please insert wait time (0,1 or 2) : ");
int time = int.Parse(Console.ReadLine())*1000;
Calculate(n,time);
}
What is the best method for me to call the Calculate(n,time) function for multiple n values (given one after the other), but the same time. I already thought of using an array to store multiple n values, but is there a better option.
Also I would like to pass multiple n’s as as arguments from the command line.
Any ideas?
Thanks in advance!
You just use params attribute.
This would allow you to call:
In function you can iterate: