I’m sorry, I can’t really google this because I’m not sure how to properly say this in a few words.
But basically I’d like to have something like, when you open your program via dos or via a shortcut looking like this:
“c:\program.exe” value1 value2
that my application would be able to use these values. But also when I don’t enter the values, that my application still starts fine.
I hope that made any sense what I’m trying to say here
Any help is appereciated
Those are the args that get passed to your main function:
Keep in mind, though, that there’s no way to guarantee the order of the args passed in or that they are the values you expect. You should use named arguments and then parse and validate them at the beginning of your application. Your command might look something like:
As for a good list of parsers, I would check out:
.net – Best way to parse command line arguments in C#