Parsing command-line options in C# [duplicate]
问题 This question already has answers here : Best way to parse command line arguments in C#? [closed] (20 answers) Closed 3 years ago . I've seen people write custom classes to more easily handle command line options in various languages. I wondered if .NET (3.5 or lower) has anything built in so that you don't have to custom-parse things like: myapp.exe file=text.txt 回答1: Here is another possible approach. Very simple but it has worked for me in the past. string[] args = {"/a:b", "/c:", "/d"};