Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Microsoft';你的命令是什么?_C#_Command Line_.net Core - Fatal编程技术网

C# 如何在Microsoft';你的命令是什么?

C# 如何在Microsoft';你的命令是什么?,c#,command-line,.net-core,C#,Command Line,.net Core,近年来,微软为.NET核心应用引入了命令行处理工具。下面是描述它们的文章- 基本上我们有选项和命令: Usage: [options] [command] Options: -$|-g |--greeting <greeting> The greeting to display. The greeting supports a format string

近年来,微软为.NET核心应用引入了命令行处理工具。下面是描述它们的文章-

基本上我们有选项和命令:

Usage:  [options] [command]
Options:
  -$|-g |--greeting <greeting>  The greeting to display. 
                                The greeting supports a format string 
                                where {fullname} will be substituted 
                                with the full name.
  -u | --uppercase              Display the greeting in uppercase.
  -? | -h | --help              Show help information
Commands:
  name 
Use " [command] --help" for more information about a command.
用法:[选项][命令]
选项:
-$|-g |--问候语要显示的问候语。
问候语支持格式字符串
其中{fullname}将被替换
全名。
-u |——大写字母以大写字母显示问候语。
-? | -h |--帮助显示帮助信息
命令:
名称
有关命令的详细信息,请使用“[命令]--help”。
要处理输入,我们必须创建
CommandLineApplication
类的实例,并配置选项和命令。然后运行
commandLineApplication.Execute(args)
(其中args是控制台应用程序参数,即
string[]args
),它可以工作

直到它没有

问题是只有相当模糊的文档可用。要么工具非常简单,要么文档遗漏了一些东西

我的问题是——有人知道有没有可能做出必要的选择?如果是的话,那怎么办呢


还有-如何处理空选项?不幸的是,到目前为止,如果我们像这样运行应用程序:
commandApp.exe-g
我们只会得到异常(在应用程序进入
.onExecute
处理程序之前,它甚至比异常本身更糟糕)。

代码并不难理解,请注意,这个库不会再增长太多。微软不会追求它,而是开始一个新的,