【发布时间】:2016-03-08 17:19:56
【问题描述】:
我尝试将布尔参数传递给控制台应用程序并使用Command Line Parser Library 处理该值。
[Option('c', "closeWindow", Required = true, HelpText = "Close the window.")]
public bool CloseWindow { get; set; }
我尝试将参数传递为
-c false
-c False
-c "false"
-...
没有区别,每次尝试我都会得到 "true" 作为值。
谁能告诉我如何传递参数来获取布尔值false?
为了避免可能的询问,有一个正确传递的字符串选项:
[Option('s', "system", Required = true, HelpText = "Any help text")]
public string System { get; set; }
【问题讨论】:
-
我会认为布尔参数存在或不存在。他们不需要和争论 - 不知道如何使用
Required = true
标签: c# nuget-package command-line-parser