To get user input in "arg" format, you use Console.ReadLine():
string[] userArgs = Console.ReadLine().Split(' ');
The Console.ReadLine gets the entire input string, then to get the array we call .Split()
. I split on spaces just like standard command line. Other delimiters are also possible, just pass in a different character to the Split
function.
Of course, you could stick to using normal command line args and have the user enter them as part of the program call (not normally done on Windows since few people use command prompt, but it would work).
MSDN for Split in case you are interested!