I have an app that is used to run multiple reports that are then chosen by the command line argument upon run time (in scheduled Task). However, I want to be able to run it manually in visual studio and then ask me what report I want to run. Here is the code I tried:
static void Main(string[] args)
{
var TestVersion = false;
int HeaderRow = 2;
if (args.Length==0)
{
Console.WriteLine("What Report would you like to run?");
args[1] = Console.ReadLine();
}
It crashes on the args[1]
line with the following error:
Index was outside the bounds of the array.
I tried with args[0]
as well and that didn't work either. I also tried withe args passed as a normal string. How do I fix this?