This is easy. The first parameter of your entry point (typically the
Main method), will take an array of strings. This array represents the
command line that was passed into the application. From there you can
interpret it any way you wish.
internal class Args
{
public bool auto = false;
public string logDir = null;
public string testFile = null;
}
And everything is finished!!! (incl. usage-Description)
You can also specify some Attributes...
<code>
static int Main(string[] args)
{
Args myArgs = new Args();
if (!Utilities.Utility.ParseCommandLineArguments(args, myArgs))
{
Console.WriteLine((Utilities.Utility.CommandLineArgumentsUsage(
typeof(Args)));
return 1;
}
// here you can use the (filled) class
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.