Getting error when taking in command line arguments

0

I am getting an error message when taking in command line arguments into an array. The error message states the index was outside the bounds of the array. I've never done this before and found an example online where this works.

This also works with local file paths but not UNC paths. I don't understand why what the string contains would cause an error like this. please help!

private static string[] _allFiles;
private static string _pickup;
private static string _dropOff;
private static int _size;
private static string _sizeInBytes;

static void Main(string[] args)
{
    _pickup = args[0];
    _dropOff = args[1];
    _sizeInBytes = args[2];

    SplitFiles();
}

Error is received at _dropOff = args[1];

System.IndexOutOfRangeException occurred HResult=0x80131508 Message=Index was outside the bounds of the array. Source= StackTrace:

c#
asked on Stack Overflow Oct 16, 2017 by funktail1989 • edited Oct 16, 2017 by cramopy

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0