I have the following code :
public object[] Dispatch(string arg)
{
int time;
int i = 0;
object[] array = new object[10];
if (int.Parse(arg) >= 0 && int.Parse(arg) <= 20)
{
array[i] = new ComputeParam(int.Parse(arg));
}
else
{
if (arg[0] == '/' && arg[1] == 't')
{
Options opt = new Options();
time = opt.Option(arg);
}
}
return array;
}
I pass arguments to my program and ArgsParser either puts them into an array if they are numbers or sets a delay time if the argument is something like /t:=Max.
The thing is I need both the array and the time and I can’t return two values. How can I go about solving this problem?
You can use a return class for that, just create a custom object:
and change your function, so: