Introducing the Command Line Parser Library to make parsing command line arguments easier
November 10, 2015 3 Comments
If you’ve worked extensively with .NET console applications then you’ve probably encountered difficulties with parsing the command line arguments. They are passed into the args argument of the Main function. Then it’s your task to investigate if the caller has passed in all necessary arguments:
- Have all the mandatory arguments been passed in?
- What default value do we take for optional arguments?
- What about the ordering of arguments?
…et cetera, the list could grow a lot longer.
Fortunately there are libraries that can help you parse the arguments. One such library is called Command Line Parser Library available from NuGet here. You can find its project page here with some initial code examples.